# import a vardef
#' @title Read a variable definition file
#'
#' @param df A data frame with the raw variable definition table
#' @param type Type of the file. Could be "xlsx", "csv" or "csv2"
#' @param user_colnames If you don't use generic colnames, define the name in the form c(key = "value"). See details
#'
#' @details \code{colnames} parameter by default are c(var_name = "variable", label="label", description="description", type="type", commentary="commentaire", levels="clef_modalite", labels="nom_modalit"). It could be overwriten by passing c(key = "value") in the \code{colnames} parameter.
#' @export
create.vardef <- function(df, user_colnames=NULL){
# Change the column names to standars ones
#for testing
df <- test_vardef
user_colnames <- c("var_name"="variable","commentary"="commentaires","levels"="clef_modalite","names"="nom_modalite")
vardef_colnames <- set_vardef_colnames(user_colnames)
default_colnames <- names(vardef_colnames)
modified_df <- df
for(i in seq_along(vardef_colnames)){
colnames(modified_df) <- gsub(pattern=vardef_colnames[i],replacement=default_colnames[i],colnames(x=df))
}
}
}
vector_to_variableobject <- function(vardef_vector){
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.