expandMethod: Expand method in BenchDesign object

Description Usage Arguments Value Author(s) See Also Examples

View source: R/expandMethod.R

Description

Takes a BenchDesign object, the name of an existing method, and new parameter specifications, and returns a modified BenchDesign object with new methods added. The named method is "expanded" to mutliple methods according to the specified set of parameters.

Usage

1
2
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 method should be removed. (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 with new methods with specified parameters added.

Author(s)

Patrick Kimes

See Also

modifyMethod, addMethod, dropMethod

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
## 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 - params is a list of quosure lists
newparams <- list(bonf = rlang::quos(p = round(pval, 5), method = "bonferonni"),
                  bh = rlang::quos(p = round(pval, 3), method = "BH"))
bench_exp <- expandMethod(bench, label = "padjust", params = newparams)
BDMethodList(bench_exp)

## only modify a single parameter - params is a quosure list
newparams <- rlang::quos(bonf = "bonferonni", BH = "BH")
bench_exp <- expandMethod(bench, label = "padjust", onlyone = "method", params = newparams)
BDMethodList(bench_exp)

SummarizedBenchmark documentation built on Nov. 8, 2020, 8:30 p.m.