inst/README.markdown

conf

Persistent Package Configuration

Linux Build Status Windows Build status CRAN RStudio mirror downloads Coverage Status

Store the configuration of your package in the user's platform dependent config file directory. The configuration persists across R sessions, and can also be edited manually. Configuration files are YAML files.

Installation

Once on CRAN, install the package with:

install.packages("conf")

Usage

library(conf)

conf uses the rappdirs package (https://github.com/hadley/rappdirs) to determine the appropriate location of the configuration file of a package.

To determine the location of the configuration file, you can use:

conf$new(package = "mypackage")$get_path()
#> [1] "/Users/gaborcsardi/Library/Application Support/r-config/mypackage/config.yaml"

Create a configuration file by creating a conf object, then setting some configuration keys in it, and writing it out to a file:

cf <- conf$new(package = "mypackage", lock = TRUE)
cf$set("user:id", "test-user")
cf$set("user:email", "test@acme.com")
cf$set("rversion", format(getRversion()))
cf
#> user:
#>   id: test-user
#>   email: test@acme.com
#> rversion: 3.5.3
cf$save()

License

MIT © RStudio Inc



r-lib/conf documentation built on May 14, 2019, 2:31 p.m.