fun_logic_assg: Logical assignment, a MJP team defined function

Description Usage Arguments Value Examples

View source: R/fun_logic_assg.r

Description

Logical assignment, a MJP team defined function

Usage

1
fun_logic_assg(x, reference, typo_col = "TYPO", replace_col = "REPLACEMENT")

Arguments

x

A input variable/ column/ vector of strings to perform the logical assignment on

reference

A reference table (lookup table) having at least 2 column for matching the typo and returning the replacement

typo_col

The name ( as a "character") of the column in the reference table that allows the function to match with the input column "x"

replace_col

The name (as a "character) of the column in the reference table that contains the coresponding values to be returned.

Value

A vector (character) that contains the replacement values from the reference table

Examples

1
2
     ref_table <- data.frame(cars = rownames(mtcars), cyl = mtcars$cyl)
     fun_logic_assg(rownames(mtcars) , ref_table, typo_col = "cars", replace_col = "cyl")

richielin/mjp documentation built on May 5, 2019, 12:32 p.m.