wiggle | R Documentation |
Creates a new data.frame with copies of the original observation, each assigned to a different user-specified value of a variable. Allows the user to look at the effect on predicted values of changing either a single variable or multiple variables.
wiggle(data, varlist, valueslist)
data |
a data frame with one or more observations to be reassigned |
varlist |
a character vector specifying the name(s) of the variable to adjust |
valueslist |
a list of vectors with the values to assign to var |
If the variable specified is a factor, then wiggle will return it as a character.
a data.frame
with each row assigned to the one of the new variable combinations.
All variable combinations are returned, eg wiggling two variables with 3 and 4 variables
respectively will return a new dataset with 3 * 4 = 12
observations.
data(iris)
wiggle(iris[3,], varlist = "Sepal.Width", valueslist = list(c(1, 2, 3, 5)))
wiggle(iris[3:5,], "Sepal.Width", valueslist = list(c(1, 2, 3, 5)))
wiggle(iris[3,], c("Sepal.Width", "Petal.Length"), list(c(1,2,3,5), c(3,5,6)))
wiggle(iris[3:5,], c("Sepal.Width", "Petal.Length"), list(c(1,2,3,5), c(3,5,6)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.