htmlize_datatable | R Documentation |
Add HTML styling to better display data tables.
htmlize_datatable(
df,
type = "basic",
digits = 2,
add_bttns = FALSE,
new_width = "50px",
...
)
df |
Data frame. The data to be displayed. |
type |
String. Either 'basic' (default) or 'fancy'. Basic type removes pagination, search box and information. It only shows the data table as a plain HTML table. Fancy type keeps all these features and in addition allows you to change the width of all the columns at once. |
digits |
Integer. The number of digits (default = 2) to show after the decimal point for only the columns with decimal values, not the ones with all integer values. |
add_bttns |
Logical. If TRUE, add three buttons ('Copy', 'Print' and 'Download') to the displayed data table. Default is FALSE. |
new_width |
String or integer. New width of all the columns. Default is '50px'. You can also supply an integer instead of a string (for example, 50 instead of '50px'). |
... |
Other parameters (such as rownames = F) that can be passed into 'DT::datatable()'. |
A 'DT::datatable()' object, which can be rendered under 'DT::renderDataTable()' and by default will show rownames.
htmlize_datatable(iris, type = 'basic', digits = 1, rownames = F)
htmlize_datatable(iris, type = 'basic', digits = 1, rownames = paste0('AA', 1:nrow(iris)))
htmlize_datatable(iris, type = 'fancy', digits = 1, add_bttns = TRUE)
htmlize_datatable(iris, type = 'fancy', digits = 1, new_width = 25)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.