R/fix_special_characters_in_data.R
fix_special_characters_in_data.Rd
This function removes non-alphanumeric characters from all non-numeric columns in a data frame. The columns are modified in-place.
fix_special_characters_in_data(df)
A data frame.
A modified data frame where all non-numeric columns have had non-alphanumeric characters removed.
df <- data.frame(a = c("A*B", "C&D"), b = c("1.2", "3.4"))
fix_special_characters_in_data(df)
#> Warning: NAs introduced by coercion
#> a b
#> 1 AB 1.2
#> 2 CD 3.4
# Output:
# a b
# 1 AB 1.2
# 2 CD 3.4