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
Wollongong 13.2 17.9 0 NA
WaggaWagga 12.3 22.7 0 4.8
Melbourne 8.2 15.3 0 2.4
MountGinini 16.7 27.3 0 NA
Sydney 13.2 20.9 0 3.4

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
Wollongong 13 18 0 NA
WaggaWagga 12 23 0 5
Melbourne 8 15 0 2
MountGinini 17 27 0 NA
Sydney 13 21 0 3


Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes 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