transform_vars: Transform data of numeric variables

View source: R/mutate.R

transform_varsR 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 data to transform

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

code

Examples

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


iNZightTools documentation built on Oct. 12, 2023, 5:06 p.m.