transformVar: Transform data of a numeric variable
Description
Transform the values of a numeric variable by applying
a mathematical function
Usage
transformVar(
.data,
var,
transformation,
name = sprintf("%s.%s", transformation, var)
)
Value
the original dataframe containing a new column of the transformed
variable with tidyverse code attached
Arguments
.data
a dataframe with the variables to transform
var
a character of the numeric variable in .data to transform
transformation
a name of a valid mathematical function that can
be applied to numeric values, eg. "log", "exp", "sqrt".
For squaring, use "square"; for inverting, use "reciprocal"