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.
The default
configuration provides a set of values to
use when no named configuration is active. Other configurations
automatically inherit all default
values so need only
define values specialized for that configuration.
For example, in this configuration the production
configuration doesn’t specify a value for trials
so it will
be read from the default
configuration:
config.yml
R
All configurations automatically inherit from the
default
configuration. Configurations can also inherit from
one or more other named configurations. For example, in this file the
production
configuration inherits from the
test
configuration:
config.yml
default:
trials: 5
dataset: "data-sampled.csv"
test:
trials: 30
dataset: "data-test.csv"
production:
inherits: test
dataset: "data.csv"
R
You can execute R code within configuration files by prefacing values
with !expr
. This could be useful in cases where you want to
base configuration values on environment variables, R options, or even
other config files. For example:
config.yml
default:
cores: 2
debug: true
server: "localhost:5555"
production:
cores: !expr getOption("mc.cores")
debug: !expr Sys.getenv("ENABLE_DEBUG") == "1"
server: !expr config::get("server", file = "etc/server-config.yml")
The default result:
R
The production result will depend on the environment variables on the server:
server-config.yml
R
You can use any previously assigned parameter inside of R code so long as it is assigned directly.
config.yml
default:
file: "data.csv"
test:
data_dir: "test/out"
dataset: !expr file.path(data_dir, file)
production:
data_dir: "production/out"
dataset: !expr file.path(data_dir, file)
R
R
The ability to use R expressions gives substantial flexibility to allow configurations to depend on environment variables, files and other information that’s available in the target environment.
However, keep in mind these limitations:
If the config file violates these limitations,
config::get()
will throw an error.
As an example, let’s say you want to construct a configuration that computes a location based on a filename and a folder.
If both filename
and folder
are constant
(i.e. not computed expressions) this works:
config.yml
R
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.