transform_vars {iNZightTools} | R Documentation |
Transform data of numeric variables
Description
Transform the values of numeric variables by applying a mathematical function
Usage
transform_vars(data, vars, fn, names = NULL)
Arguments
data |
a dataframe with the variables to transform |
vars |
a character of the numeric variables in |
fn |
the name (a string) of a valid R function |
names |
the names of the new variables |
Value
the original dataframe containing the new columns of the transformed variable with tidyverse code attached
Author(s)
Zhaoming Su
See Also
Examples
transformed <- transform_vars(iris,
var = "Petal.Length",
fn = "log"
)
cat(code(transformed))
head(transformed)
[Package iNZightTools version 2.0.1 Index]