Converts an evalGrid object into a data.frame

Share:

Description

Converts the results contained in the object returned by evalGrids into a data.frame. If the results can not be coerced automatically into a data.frame, the user can provide a function to pre-process the results (see convert.result.fun). Furthermore, univariate functions to summarize the results over the replications can be specified via summary.fun.

Usage

1
2
3
## S3 method for class 'evalGrid'
as.data.frame(x, ..., convert.result.fun = identity,
  summary.fun = NULL, progress = FALSE)

Arguments

x

an object returned by evalGrids

...

only for S3 method consistency

convert.result.fun

a functions that converts the result object contained in x into a data.frame

summary.fun

univariate functions to summarize the results (numeric or logical) over the replications, e.g. mean, sd. Alternatively, summary.fun can be one function that may return a vector.

progress

if TRUE a progress bar is shown in the console.

Value

a data.frame with the parameter constellations for the data generation and evaluation and the results (probably summarized).

Author(s)

Marsel Scheer

See Also

evalGrids

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
genRegData <- function(){
 data.frame(
     x = 1:10,
     y = rnorm(10, mean=1:10))
}

eg <- evalGrids(
 expandGrid(fun="genRegData"),
 expandGrid(proc="lm", formula=c("y ~ x", "y ~ x + I(x^2)")),
 replications=5)

lm2df = function(lm.object) {
 ret = coef(summary.lm(lm.object))[, 1:2]
 data.frame(covariable = rownames(ret), ret, check.names=FALSE)
}
as.data.frame(eg, convert.result.fun=lm2df, progress=TRUE)
as.data.frame(eg, convert.result.fun=lm2df, summary.fun=c(mean, sd), progress=TRUE)