26.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
Tuggeranong 10.0 25.1 0.2 NA
Wollongong 20.8 30.7 1.0 NA
Dartmoor 5.7 14.9 1.6 2.6
Sale 16.8 28.8 0.0 6.0
WaggaWagga 7.7 31.3 0.0 4.0

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
Tuggeranong 10 25 0 NA
Wollongong 21 31 1 NA
Dartmoor 6 15 2 3
Sale 17 29 0 6
WaggaWagga 8 31 0 4

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-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0