Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ potions Public

❗ This is a read-only mirror of the CRAN R package repository. potions — Easy Options Management. Homepage: https://potions.ala.org.au Report bugs for this package: https://github.com/AtlasOfLivingAustralia/potions/issues

Notifications You must be signed in to change notification settings

cran/potions

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

potions

easy options management






Overview

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:

  • minimalist: potions has only three core functions: brew(), pour() and drain()
  • laconic: functions use as few characters as possible
  • familiar: uses a UI for data retrieval based on the here package

In 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")
remotes::install_github("atlasoflivingaustralia/potions")

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()

About

❗ This is a read-only mirror of the CRAN R package repository. potions — Easy Options Management. Homepage: https://potions.ala.org.au Report bugs for this package: https://github.com/AtlasOfLivingAustralia/potions/issues

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages