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
Williamtown 11.5 16.8 20.2 0.8
SydneyAirport 13.6 17.9 8.2 2.0
MelbourneAirport 21.0 34.1 0.0 14.2
Canberra 15.9 26.0 6.8 NA
Richmond 1.8 20.0 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
Williamtown 12 17 20 1
SydneyAirport 14 18 8 2
MelbourneAirport 21 34 0 14
Canberra 16 26 7 NA
Richmond 2 20 0 NA

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