convertDf: Convert to SimDesign Object

Description Usage Arguments Value See Also Examples

View source: R/convertDf.R

Description

convertDf is a helper function that can convert a data.frame into a SimDesign object.

Usage

1

Arguments

x

A data.frame object, specifically with simulation design variables specified as factors, and simulation results as numeric.

Value

A data.frame object also of class SimDesign.

See Also

SimDisplay

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run: 
n <- c(15, 30, 50)
sd <- c(0.5, 1, 2)
skew <- c(1, 5, 10)
dat <- expand.grid(N = n, SD = sd, Skew = skew,
                   KEEP.OUT.ATTRS = FALSE)
set.seed(123)
dat$Result1 <- rnorm(27)
dat$Result2 <- rnorm(27)

convertDf(dat) # Error: N, SD, and Skew not set as factors

dat[,1:3] <- lapply(dat[,1:3], as.factor)
newdat <- convert_df(dat)
str(newdat)

## End(Not run)

mattsigal/SimDisplay documentation built on May 21, 2019, 1:25 p.m.