Data Science Desktop Survival Guide
by Graham Williams |
|||||
Formatting Options |
Raw 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)
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)
NOT QUITE WORKING YET - STILL WANT COLUMN TREATED AS NUMERIC. We can the remove the missing values (recorded as NA) with a simple stringr::str_replace().
|
ds %>% replace(is.na(.), "") %>% kable(row.names=FALSE, digits=0)
## Error: Assigned data `values` must be compatible with existing data.
|