repwithna: Replacing uninformative strings with NAs

Description Usage Arguments Value Examples

View source: R/repwithna.R

Description

Replace uninformative strings (eg. empty strings like ”) in the data frame with NAs, so they can be removed as missing values. By default, empty strings will be replaced. If 'rmvsym' is set to 'True', strings containing only symbols will also be replaced. If 'format' is set with a regular expression, the function will replace all the strings of non-compliant formats with NAs.

Usage

1
repwithna(df, rmvsym = FALSE, format = NULL)

Arguments

df

the input data frame

rmvsym

The default value is False. If True, remove all the strings containing only symbols

format

A regular expression representing the format of the string value in the data frame

Value

data frame

Examples

1
repwithna(data.frame("Name" = c("  ", ",.;"), "Age" = c(21,15)), rmvsym=TRUE)

UBC-MDS/Rcat documentation built on March 30, 2020, 11:43 p.m.