BDMethod: Create a new BDMethod object

Description Usage Arguments Value Author(s) See Also Examples

Description

Initializes a new BenchDesign method object for benchmarking.

New BDMethod objects are typically not directly constructed as they have limited use outside of BenchDesign objects. Instead, methods in a BenchDesign object are more commonly created, modified or removed using function calls on the BenchDesign, e.g. using addMethod to add a new method object.

The constructor can also be used to access BDMethod objects stored in BDMethodList and BenchDesign objects.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
BDMethod(x, params = rlang::quos(), post = NULL, meta = NULL, ...)

## S4 method for signature 'quosure'
BDMethod(x, params = rlang::quos(), post = NULL,
  meta = NULL, ...)

## S4 method for signature ''function''
BDMethod(x, params = rlang::quos(), post = NULL,
  meta = NULL, ...)

## S4 method for signature 'BDMethodList'
BDMethod(x, i = 1)

## S4 method for signature 'BenchDesign'
BDMethod(x, i = 1)

Arguments

x

main method function or function quosure. Alternative, may be a BDMethodList or BenchDesign object from which the BDMethod should be extracted.

params

list of quosures specifying function parameters. (default = rlang::quos())

post

list of functions to be applied to the output of x. (default = NULL)

meta

list of metadata. (default = NULL)

...

other parameters.

i

integer index or character name of BDMethod in BDMethodList or BenchDesign object.

Value

BDMethod object

Author(s)

Patrick Kimes

See Also

BDMethod-class, BenchDesign, BDMethodList

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## create a simple BDMethod
bdm1 <- BDMethod(x = base::mean)

## create a more complex BDMethod
bdm2 <- BDMethod(x = function(x) { x^2 }, post = base::sqrt,
                 meta = list(note = "simple example"))

## construct a BenchDesign with the BDMethod objects
bd <- BenchDesign(method1 = bdm1, method2 = bdm2)

## access a BDMethod in the BenchDesign
BDMethod(bd, "method1")

areyesq89/SummarizedBenchmark documentation built on Sept. 2, 2021, 4:15 p.m.