expandMethod {SummarizedBenchmark}R Documentation

Expand method in BenchDesign object across parameter settings

Description

This function takes a BenchDesign object and the name of a method already defined in the object, and returns a modified BenchDesign object with multiple variants of the method differing only by the specified parameter sets. In other words, this function "expands" the set of methods using a set of parameters.

Usage

expandMethod(bd, label, params, onlyone = NULL, .replace = FALSE,
  .overwrite = FALSE)

Arguments

bd

BenchDesign object.

label

Character name of method to be expanded.

params

Named list of quosure lists specifying the label of the new methods to be added to the BenchDesign, and the set of parameters to overwrite in the original method definition for each new method. Alternatively, if onlyone is non-NULL, a single quosure list with name = value pairs specifying the label of the new methods and the values to use for overwriting the parameter specified in onlyone.

onlyone

Character name of a parameter to be modified. Only specify if just a single parameter should be replaced in the original method definition. Ignored if NULL. (default = NULL)

.replace

Logical whether original label object should be removed if method expansion is successful. (default = FALSE)

.overwrite

Logical whether to overwrite the existing list of parameters (TRUE) or to simply add the new parameters to the existing list (FALSE). (default = FALSE)

Value

Modified BenchDesign object.

Author(s)

Patrick Kimes

Examples

## empty BenchDesign
bench <- BenchDesign()

## add basic 'padjust' method
bench <- addMethod(bench, label = "padjust",
                   func = p.adjust,
                   params = rlang::quos(p = pval,
                                        method = "none"))

## modify multiple parameters, "p" and "method"
bench_exp <- expandMethod(bench, label = "padjust",
                          params = list(
        bonf = rlang::quos(p = round(pval, 5),
                           method = "bonferonni"),
        bh = rlang::quos(p = round(pval, 3),
                         method = "BH")))
printMethods(bench_exp)

## only modify a single parameter using the 'onlyone=' parameter
bench_exp <- expandMethod(bench, label = "padjust",
                          onlyone = "method",
                          params = rlang::quos(bonf = "bonferonni",
                                               BH = "BH"))
printMethods(bench_exp)


[Package SummarizedBenchmark version 2.2.2 Index]