#' Generate column names for percentage table
#'
#' Formats column names to be used with a percentage table
#' @param .table Data table
#' @param .var Column name for variable of interest
#' @param .admbounds String specifying administrative codes
#' @return List of formatted column names
#' @export
#' @examples
#' prepLabels(data[['building']], 'dm_grade', 'ward')
prepLabels <- function(.table, .var, .admbounds) {
codes <- sort(unique(.table[[.var]]),na.last=TRUE)
var_names <- sapply(codes, function(x) paste(.var,x,sep=""))
out_names <- c(.admbounds,var_names)
return(out_names)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.