sternclean: A cleaner way to clean your data.

Description Usage Arguments Examples

View source: R/sternclean.R

Description

A cleaner way to clean your data. It's recommended to keep all parameters lined up and on separate lines to produce greater readability and to make debugging easier. The function edits the data frame and automatically assigns the results to the data frames. We have kept the parameters starting with 3 separate verbs to make finding the correct parameter easier. after typing either class, remove, or impute. One can simply use tab to fill in the specific action they prefer.

Usage

1
2
3
4
5
6
7
sternclean(the_data_frame = "the_data_frame", class_to_strng = "",
  class_to_numer = "", remove_columns = "", remove_na_rows = "",
  removeby_regex = "", remove_all_nas = FALSE, remove_non_num = FALSE,
  remove_all_exc = "", impute_na2mean = "", impute_na_cols = "",
  impute_na_with = "", impute_grpmean = "", impute_grpwith = "",
  impute_inf_col = "", impute_inf_wit = "", impute_cust_cl = "",
  impute_cust_fn = "", ...)

Arguments

the_data_frame

tbl

class_to_strng

vector of columns to convert to string.

class_to_numer

vector of columns to convert to numeric.

remove_columns

vector of columns to remove from tbl.

remove_na_rows

vector of columns to remove rows by their NAs.

removeby_regex

vector of columns found by regex to remove.

remove_all_nas

TRUE/FALSE to remove all NAs by row. Default: False.

remove_non_num

TRUE/FALSE to remove non-numeric columns. Default: False.

remove_all_exc

vector of columns to keep. Remove all other columns.

impute_na2mean

vector of columns to impute NAs with the column mean.

impute_na_cols

vector of columns to impute with value given by the impute_na_with parameter.

impute_na_with

value to impute in the vector of columnns from the impute_na_cols parameter.

impute_grpmean

vector of columns to replace NAs with a groupmean, grouped by the impute_grpwith parameter.

impute_grpwith

column to use as the group for the vector of columns defined by the impute_grpmean parameter.

impute_inf_col

vector of columns to impute infinite values with the impute_inf_wit parameter value.

impute_inf_wit

value to impute in the vector of columnns from the impute_inf_col parameter.

impute_cust_cl

vector of columns to impute NAs with based on the function defined by the impute_cust_fn parameter.

impute_cust_fn

function to impute the NAs over the columns defined in the impute_cust_cl parameter.

...

additional parameters for the function from the impute_cust_fn parameter.

Examples

1
2
3
4
5
6
7
8
9
sternclean("airquality",
       impute_na2mean = c("Ozone", "Solar.R"))
sternclean("airquality",
       impute_na_cols = c("Ozone", "Solar.R"),
       impute_na_with = 1738)
sternclean("airquality",
       remove_columns = "Day"
       impute_na_cols = "Solar.R",
       impute_na_with = 1738)

basketballbeane/sternclean documentation built on Sept. 10, 2021, 7:50 a.m.