Learn R Programming

merTools (version 0.2.1)

wiggle: Assign an observation to different values

Description

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 of changing a variable on predicted values.

Usage

wiggle(data, var, values)

Arguments

data
a data frame with one or more observations to be reassigned
var
a character specifying the name of the variable to adjust
values
a vector with the variables to assign to var

Value

a data frame with each row in data assigned to all values for the variable chosen

Details

If the variable specified is a factor, then wiggle will return it as a character.

Examples

Run this code
data(iris)
wiggle(iris[3,], "Sepal.Width", values = c(1, 2, 3, 5))
wiggle(iris[3:5,], "Sepal.Width", values = c(1, 2, 3, 5))

Run the code above in your browser using DataLab