R: Assign an observation to different values

wiggle {merTools} | R Documentation

## 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

### Details

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

### Value

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

### Examples

    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))

[Package merTools version 0.3.0 Index]