Description Arguments Value Examples
Wrapper around the default multi_column_transformation mungebit to make new variables.
df |
dataframe. The dataframe to modify. |
fun |
function. The function to run to convert old_variables to new_variables. Also can take a non-function expression that will be converted to function() expression. |
old_variables |
character. The names of the variables needed to make the new_variable. |
new_variable |
character. The name of the desired new variable. |
Does not return anything, but modifies-in-place the dataframe to have that new variable.
1 2 3 4 5 6 7 8 9 10 11 12 13 | new_variable()$run(iris, function(Sepal.Width, Sepal.Length) Sepal.Width*2 + Sepal.Length*2, 'Sepal.Perimeter')
#TODO: (RK) Fix broken example.
#new_variable()$run(iris, iris$Sepal.Width, 'Sepal.Width2')
## Not run:
# Usage in a Syberia file
list("Make new variable" = list(
new_variable,
function(Sepal.Width, Sepal.Length) Sepal.Width*2 + Sepal.Length*2,
'Sepal.Perimeter'
))
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.