make_table_dt: make_table_dt a function that prepares data (add colnames,...

View source: R/fct_helpers.R

make_table_dtR Documentation

make_table_dt a function that prepares data (add colnames, relocate, etc.) and makes a DT table which also formats numbers nicely

Description

make_table_dt a function that prepares data (add colnames, relocate, etc.) and makes a DT table which also formats numbers nicely

Usage

make_table_dt(
  data,
  var_commune,
  var_year,
  var_values,
  var_cat,
  unit,
  icons_palette,
  na_string = "(Non disponible)",
  DT_dom = "lfrtip"
)

Arguments

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

Value

a dataTable object


vdes2020/eneRgyVD documentation built on July 3, 2025, 7:36 p.m.