prep_table.Rd
This function prepares a data table for displaying by providing user-friendly names, removing unneeded variables, and formatting percentages.
A string specifying the column name to be used as the y-axis variable.
A data frame containing the raw data.
A data frame containing the summarized data.
A string specifying the ID associated with the data.
An optional string specifying the column name to be used as the second y-axis variable. Default is NULL.
A symbol specifying the column to be used for faceting. Default is 'VIS_Groep'.
A symbol specifying the column to be used for faceting names. Default is 'VIS_Groep_naam'.
Choose from basic for a simple datatable and advanced for more buttons etc.
A logical value indicating whether to display row names.
A character vector specifying the DataTables extensions to be used.
A list of DataTables options.
A character string indicating how to limit column width.
Further arguments passed on to the 'make_basic_table' function.
A DT::datatable object ready for displaying.
df <- data.frame(VIS_Groep = c("Group1", "Group1", "Group2", "Group2"),
VIS_Groep_naam = c("Name1", "Name1", "Name2", "Name2"),
y = c(TRUE, TRUE, FALSE, FALSE), z = c(TRUE, FALSE, TRUE, FALSE))
df_summarized <- df %>%
dplyr::group_by(VIS_Groep, VIS_Groep_naam) %>%
dplyr::summarise(
y = mean(y),
z = mean(z)
) %>%
dplyr::ungroup()
#> `summarise()` has grouped output by 'VIS_Groep'. You can override using the
#> `.groups` argument.
id <- "id"
output <- prep_table("y", df, df_summarized, id = id)