Learn R Programming

fixr (version 0.2.0)

fix.data: Fix data frame column and row names and remove symbols and blanks

Description

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.

Usage

fix.data(df)

Value

The cleaned data frame.

Arguments

df

A data frame to be processed.

Examples

Run this code
df <- data.frame(" 1st col " = c("", "foo", ""), "2nd col" = c(" ", " ", "bar"),
                 "3rd col" = c(1, 2, 3))
fix.data(df)

Run the code above in your browser using DataLab