https://github.com/r-lib/conf
Persistent Package Configuration
https://github.com/r-lib/conf
r
Last synced: 4 months ago
JSON representation
Persistent Package Configuration
- Host: GitHub
- URL: https://github.com/r-lib/conf
- Owner: r-lib
- License: other
- Archived: true
- Created: 2017-06-17T22:39:42.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-03-26T20:39:54.000Z (about 6 years ago)
- Last Synced: 2024-08-13T07:14:43.503Z (8 months ago)
- Topics: r
- Language: R
- Size: 20.5 KB
- Stars: 7
- Watchers: 4
- Forks: 3
- Open Issues: 1
-
Metadata Files:
- Readme: README.markdown
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - r-lib/conf - Persistent Package Configuration (R)
README
# conf
> Persistent Package Configuration
[](https://travis-ci.org/r-lib/conf)
[](https://ci.appveyor.com/project/gaborcsardi/conf)
[](http://www.r-pkg.org/pkg/conf)
[](http://www.r-pkg.org/pkg/conf)
[](https://codecov.io/github/r-lib/conf?branch=master)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:
```r
install.packages("conf")
```## Usage
```r
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:
```r
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:```r
cf <- conf$new(package = "mypackage", lock = TRUE)
``````r
cf$set("user:id", "test-user")
cf$set("user:email", "test@acme.com")
cf$set("rversion", format(getRversion()))
``````r
cf
``````
#> user:
#> id: test-user
#> email: test@acme.com
#> rversion: 3.5.3
``````r
cf$save()
```## License
MIT © RStudio Inc