createNewVar {iNZightTools}R Documentation

Create new variables

Description

Create a new variable by using a valid R expression and returns the result along with tidyverse code used to generate it.

Usage

createNewVar(.data, new_var = "new.variable", R_exp)

Arguments

.data

a dataframe to which to add a new variable to

new_var

a character of the new variable name. "new.variable" by default

R_exp

a character of a valid R expression which can generate a vector of values

Value

original dataframe containing the new column created from R_exp with tidyverse code attached

Author(s)

Owen Jin

See Also

code

Examples

Run examples

created <- createNewVar(iris, new_var = "Sepal.Length_less_Sepal.Width",
 "Sepal.Length - Sepal.Width")
cat(code(created))
head(created)


[Package iNZightTools version 1.12.2 Index]