#' @title Control the provided names
#'
#' @description A function to control the names provided for the dataframe to be created.
#' A table name starting with a number is not valid for an object name in R. Thus this function adds "table_" before the number.
#'
#' @author Briac LE RAY (briac.leray@partnre.com)
#'
#' @return The given table with the chosen column transformed.
#' @param table The table to be controlled. Type = dataframe
#' @param col_name The name of the table column to control. Type = character
#' @keywords control names table check number check_names_table()
#' @examples check_names_table(table = my_table, col_name = "column_1")
check_names_table <- function(table, col_name) {
table = table %>% mutate(!!col_name := ifelse(str_detect(string = eval(parse(text = col_name)),pattern = "^[[:digit:]]"), paste0("table_", as.character(eval(parse(text = col_name)))), eval(parse(text = col_name))))
return(table)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.