Skip to contents

Converts readable names to clean ids that are easier to handle in R. Replaces all punctuation and spaces for an underscore, and transforms all uppercase letters to lowercase.

Usage

simplify_string(x)

Arguments

x

a character vector or a factor. Factors will be silently converted to character strings.

Value

character vector of the same length as the input vector.

Examples

simplify_string(c(" Dirty_name. to Clean.#$", "#$another   complicated. Name"))
#> [1] "dirty_name_to_clean"      "another_complicated_name"