Ensure column names are valid

fix_names(x, lower = FALSE)

Arguments

x

Data.frame or vector of (column) names

lower

Set letters to lower case (TRUE or FALSE)

Details

Remove symbols, trailing and leading spaces, and convert to valid R column names. Opinionated version of make.names

Examples

fix_names(c(" var-name ", "$amount spent", "100"))
#> [1] "var_name" "amount_spent" "X100"