Learn R Programming

BatchExperiments (version 1.4.3)

getResultVars: Get variable groups of reduced results.

Description

Useful helper for e.g. package plyr and such.

Usage

getResultVars(data, type = "group")

Arguments

type

[character(1)] Can be “prob” (prob + pars), “prob.pars” (only problem pars), “algo” (algo + pars), “algo.pars” (only algo pars), “group” (prob + problem pars + algo + algo pars), “result” (result column names). Default is “group”.

Value

[character]. Names of of columns.

Examples

Run this code
# NOT RUN {
reg = makeExperimentRegistry("BatchExample", seed = 123, file.dir = tempfile())
addProblem(reg, "p1", static = 1)
addProblem(reg, "p2", static = 2)
addAlgorithm(reg, id = "a1",
  fun = function(static, dynamic, alpha) c(y = static*alpha))
addAlgorithm(reg, id = "a2",
  fun = function(static, dynamic, alpha, beta) c(y = static*alpha+beta))
ad1 = makeDesign("a1", exhaustive = list(alpha = 1:2))
ad2 = makeDesign("a2", exhaustive = list(alpha = 1:2, beta = 5:6))
addExperiments(reg, algo.designs = list(ad1, ad2), repls = 2)
submitJobs(reg)
data = reduceResultsExperiments(reg)
library(plyr)
ddply(data, getResultVars(data, "group"), summarise, mean_y = mean(y))
# }

Run the code above in your browser using DataLab