createNewVar {iNZightTools} | R Documentation |
Create a new variable by using a valid R expression and returns the result along with tidyverse code used to generate it.
createNewVar(.data, new_var = "new.variable", R_exp)
.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 |
original dataframe containing the new column
created from R_exp
with tidyverse code attached
Owen Jin
created <- createNewVar(iris, new_var = "Sepal.Length_less_Sepal.Width",
"Sepal.Length - Sepal.Width")
cat(code(created))
head(created)