Learn R Programming

simTool (version 1.1.4)

as.data.frame.evalGrid: Converts an evalGrid object into a data.frame

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

# S3 method for 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).

See Also

evalGrids

Examples

Run this code
# NOT RUN {
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)
# }

Run the code above in your browser using DataLab