This function applies several data cleaning functions from the fixr
package to a given data frame. The fix_data_names
, remove_spaces
, remove_symbols_data
, and replace_blanks_with_na
functions are used to add "X_" before column and row names that start with a number, remove leading/trailing spaces, remove non-alphanumeric characters from the data, replace spaces with underscores in column and row names, and replace empty string values with NAs, respectively.
fix.data(df)
A data frame to be processed.
The cleaned data frame.
df <- data.frame(" 1st col " = c("", "foo", ""), "2nd col" = c(" ", " ", "bar"),
"3rd col" = c(1, 2, 3))
fix.data(df)
#> Warning: NAs introduced by coercion
#> Warning: NAs introduced by coercion
#> 1stcol 2ndcol 3rdcol
#> 1 <NA> <NA> 1
#> 2 foo <NA> 2
#> 3 <NA> bar 3