clean_id: Clean ID

Description Usage Arguments Details Value See Also Examples

View source: R/clean_id.R

Description

Provides a method for applying both cleaning functions (clean_x and clean_case) to a dataframe by index.

Usage

1
clean_id(data, cols = list(), FUN = list())

Arguments

data

is a data.frame containing any number of columns.

cols

is a list of integers or column names indicating the columns that are to be cleaned up.

FUN

is a list of functions to pass to the specified columns (must be in same order as the column index)

Details

This function is meant to be used on multiple columns at once. It makes use of the magrittr pipe operator to provide neat code.

Value

Returns a dataframe with replacements in the specified columns

See Also

clean_x, clean_case

Examples

1
2
3
4
5
6
7
df <- data.frame(pbnum = c("PB123", "PB 0034", "  5678 ", "None"),
status = c("Active", "Closed", "Closed", "Active"),
xnum = c("X00123", "9512", "X789", "NOT IN APS"))

#' df %>% clean_id(cols = c(1,3), FUN = c("clean_case", "clean_x"))

#' clean_id(data = df, cols = c(1,3), FUN = c("clean_case", "clean_x"))

georgemirandajr/identifyr documentation built on May 17, 2019, 1:15 a.m.