The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.
Often it is useful to set bespoke options for a single workflow, or
within a single package, without altering global options that influence
other users or packages. This is possible using
base::options()
and related functions, however doing so
requires care, and occasionally some bespoke knowledge.
potions
makes options management as easy as possible, by
decreasing programmers’ cognitive burden while storing and retrieving
information. It does this by following three guiding principles:
potions
has only three
core functions: brew()
, pour()
and
drain()
here
packageIn combination, these features should make it easy for users and
developers to manage options using potions
.
To install from CRAN:
install.packages("potions")
To install from GitHub:
install.packages("remotes")
::install_github("atlasoflivingaustralia/potions") remotes
To store data in options()
, use brew()
library(potions)
brew(list(x = 1, y = list(a = 2, b = 4))) # use a list
brew(x = 1) # or as named arguments
Then you can use pour()
to get the information you
need:
pour() |> str() # get all data
#> List of 2
#> $ x: num 1
#> $ y:List of 2
#> ..$ a: num 2
#> ..$ b: num 4
pour("x") # get a subset of data
#> [1] 1
pour("y", "a") # for nested data
#> [1] 2
When you are done, simply use drain()
to clean up:
drain()
pour() # nothing to return
#> list()
These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.