create_vars | R Documentation |
Create new variables by using valid R expressions and returns the result along with tidyverse code used to generate it.
create_vars(data, vars = ".new_var", vars_expr = NULL)
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 |
original dataframe containing the new columns
created from vars_expr
with tidyverse code attached
Zhaoming Su
code
created <- create_vars(
data = iris,
vars = "Sepal.Length_less_Sepal.Width",
"Sepal.Length - Sepal.Width"
)
cat(code(created))
head(created)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.