Apply a function over a list of vectors of parameter values
papply.RdApply a function over a list of vectors of parameter values
Usage
papply(
parameterList = NULL,
func,
parameterValues = NULL,
args = NULL,
progressbar = NULL,
silent = clairvoyant::opts$get("silent"),
.callingOurselves = FALSE
)Arguments
- parameterList
The named list of vectors of parameter values
- func
The function to apply
- parameterValues
Used internally; the values to use while recursing
- args
Additional arguments to pass
- progressbar
Whether to show a progress bar; set to
TRUEto show a progress bar.- silent
Whether to be silent or chatty
- .callingOurselves
Whether this function is being called recursively
Examples
### Create a simple example function
exFunc <- function(parameterValues) {
return(
parameterValues[[1]] *
parameterValues[[2]]
);
}
clairvoyant::papply(
list(
a = 1:3,
b = 5:7
),
func = exFunc
);
#> [[1]]
#> [1] 5
#>
#> [[2]]
#> [1] 6
#>
#> [[3]]
#> [1] 7
#>
#> [[4]]
#> [1] 10
#>
#> [[5]]
#> [1] 12
#>
#> [[6]]
#> [1] 14
#>
#> [[7]]
#> [1] 15
#>
#> [[8]]
#> [1] 18
#>
#> [[9]]
#> [1] 21
#>