withOpt: Temporarily changes package options

withOptR Documentation

Temporarily changes package options

Description

This function is inspired by withr::with_options: it can be used to execute some code where package options are temporarily changed. This function uses a shortened syntax, especially when changing options for patRoon.

Usage

withOpt(code, ..., prefix = "patRoon.")

Arguments

code

The code to be executed.

...

Named arguments with options to change.

prefix

A character that will be used to prefix given option names.

Examples

## Not run: 
# Set max parallel processes to five while performing formula calculations
withOpt(MP.maxProcs = 5, {
    formulas <- generateFormulas(fGroups, "genform", ...)
})

## End(Not run)


rickhelmus/patRoon documentation built on April 25, 2024, 8:15 a.m.