BDMethod {SummarizedBenchmark} | R Documentation

## Create a new BDMethod object

### 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

    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

    ## 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")

[Package SummarizedBenchmark version 2.12.0 Index]