create_vars: Create new variables

View source: R/mutate.R

create_varsR Documentation

Create new variables

Description

Create new variables by using valid R expressions and returns the result along with tidyverse code used to generate it.

Usage

create_vars(data, vars = ".new_var", vars_expr = NULL)

Arguments

data

a dataframe to which to add new variables to

vars

a character of the new variable names

vars_expr

a character of valid R expressions which can generate vectors of values

Value

original dataframe containing the new columns created from vars_expr with tidyverse code attached

Author(s)

Zhaoming Su

See Also

code

Examples

created <- create_vars(
    data = iris,
    vars = "Sepal.Length_less_Sepal.Width",
    "Sepal.Length - Sepal.Width"
)
cat(code(created))
head(created)

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