Learn R Programming

iNZightTools (version 2.0.1)

transform_vars: 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)

Value

the original dataframe containing the new columns of the transformed variable with tidyverse code attached

Arguments

data

a dataframe with the variables to transform

vars

a character of the numeric variables in data to transform

fn

the name (a string) of a valid R function

names

the names of the new variables

Author

Zhaoming Su

See Also

code

Examples

Run this code
transformed <- transform_vars(iris,
    var = "Petal.Length",
    fn = "log"
)
cat(code(transformed))
head(transformed)

Run the code above in your browser using DataLab