make_table_dt | R Documentation |
make_table_dt a function that prepares data (add colnames, relocate, etc.) and makes a DT table which also formats numbers nicely
make_table_dt(
data,
var_commune,
var_year,
var_values,
var_cat,
unit,
icons_palette,
na_string = "(Non disponible)",
DT_dom = "lfrtip"
)
data |
the dataframe or tibble to turn as a datatable |
var_commune |
colname corresponding to the municipality (passed as a string) |
var_year |
colname corresponding to the year (passed as a string) |
var_values |
colname corresponding to the value(s) (passed as a string, or a vector of string) |
var_cat |
colname corresponding to the categorical variable (passed as a string) |
unit |
the unit to display inside brackets in the supplied <var_values> variables |
icons_palette |
a dataframe of icons with two variables : the categorical variable ('var_cat') and an 'icon' variable with the full html code for the icon and color (see 'utils_helpers.R') |
na_string |
a string specifying how should NAs be displayed, as it can change from one dataset to another (defaults to : 'Non disponible') |
DT_dom |
the DT domain values to specify which DT extensions should be applied |
a dataTable object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.