A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rstudio/config below:

rstudio/config: config package for R

<style> .codeblock-label { color: #000; display: inline-block; border-top-left-radius: .5rem; border-top-right-radius: .5rem; padding: 0.25rem 0.75rem; background-color: #cccccc; margin-bottom: 0; font-size: 0.875em; font-family: var(--bs-font-monospace); } .codeblock-label + div.sourceCode { margin-top: 0; } </style> config

The config package makes it easy to manage environment specific configuration values. For example, you might want to use distinct values for development, testing, and production environments.

You can install the config package from CRAN by using:

install.packages("config")

To use config, create a file config.yml with default as well as other arbitrary configurations. For example:

config.yml

default:
  trials: 5
  dataset: "data-sampled.csv"
  
production:
  trials: 30
  dataset: "data.csv"

To read configuration values you call the config::get function, which returns a list containing all of the values for the currently active configuration:

R

config <- config::get()
config$trials
#> [1] 5
config$dataset
#> [1] "data-sampled.csv"

You can also read a single value from the configuration as follows:

R

config::get("trials")
#> [1] 5
config::get("dataset")
#> [1] "data-sampled.csv"

The config::get() function takes an optional config argument which determines which configuration to read values from (the “default” configuration is used if none is specified).

See the package vignettes at https://rstudio.github.io/config/ for more examples and instructions for advanced usage, including:

Do not attach the package using library(config)

We strongly recommend you use config::get() rather than attaching the package using library(config).

In fact, we strongly recommend you never use library(config).

The underlying reason is that the get() and merge() functions in {config} will mask these functions with the same names in base R.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4