expandMethod {SummarizedBenchmark} | R Documentation |
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.
expandMethod(bd, label, params, onlyone = NULL, .replace = FALSE, .overwrite = FALSE)
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 |
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 |
.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) |
Modified BenchDesign object.
Patrick Kimes
## with toy data.frame df <- data.frame(pval = rnorm(100)) bench <- BenchDesign(df) ## 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)