
Often it is useful to set bespoke options for a single workflow, orwithin a single package, without altering global options that influenceother users or packages. This is possible usingbase::options() and related functions, however doing sorequires care, and occasionally some bespoke knowledge.potions makes options management as easy as possible, bydecreasing programmers’ cognitive burden while storing and retrievinginformation. It does this by following three guiding principles:
potions has only threecore functions:brew(),pour() anddrain()here packageIn combination, these features should make it easy for users anddevelopers to manage options usingpotions.
To install from CRAN:
install.packages("potions")To install from GitHub:
install.packages("remotes")remotes::install_github("atlasoflivingaustralia/potions")To store data inoptions(), usebrew()
library(potions)brew(list(x =1,y =list(a =2,b =4)))# use a listbrew(x =1)# or as named argumentsThen you can usepour() to get the information youneed:
pour()|>str()# get all data#> List of 2#> $ x: num 1#> $ y:List of 2#> ..$ a: num 2#> ..$ b: num 4pour("x")# get a subset of data#> [1] 1pour("y","a")# for nested data#> [1] 2When you are done, simply usedrain() to clean up:
drain()pour()# nothing to return#> list()