Skip to contents

Convert a given string to a valid R variable name, converting spaces to underscores (_) instead of dots.

Usage

create_varname(x)

Arguments

x

a string to convert

Value

a string, which is also a valid variable name

Author

Tom Elliott

Examples

create_varname("a new variable")
#> [1] "a_new_variable"
create_varname("8d4-2q5")
#> [1] "X8d4.2q5"