28.12 Formatting Options

REVIEW Formatting options are available for fine tuning how the table is to be presented. For example we can remove the row names (the row numbers in the above table) easily with row.names=FALSE.

# Display a table without row names.

ds %>% kable(row.names=FALSE)
Location MinTemp MaxTemp Rainfall Evaporation
Sydney 13.2 29.5 0.0 6.4
Richmond 10.5 27.6 0.0 NA
MountGinini -4.1 -1.0 4.6 NA
Williamtown 7.0 18.4 NA NA
Penrith 12.1 18.2 0.0 NA

We can also limit the number of digits displayed to avoid an impression of a high level of accuracy or to simplify presentation using digits=. By doing so the numeric values are rounded to the requested number of decimal points.

# Display a table removing digits from numbers.

ds %>% kable(row.names=FALSE, digits=0)
Location MinTemp MaxTemp Rainfall Evaporation
Sydney 13 30 0 6
Richmond 10 28 0 NA
MountGinini -4 -1 5 NA
Williamtown 7 18 NA NA
Penrith 12 18 0 NA


If you find this curated material useful then you can consider a donation to support it's ongoing availability and give you access to the PDF version of this book. The material has been scoped up by Generative AI without permission or any kind of recompense so do consider a donation if you can afford it. Unlike Generative AI your access to this materials is freely given. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Togaware has a 30 year tradition of making popular open source software which includes sold privacy preserving productivity apps, rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0