Description Usage Arguments Value See Also Examples
Read from the file (JSON/INI/YAML/TOML be supported), retreiving all values as a list.
1 2 3 4 5 6 7 8 9 10 11 12 | read.config(
file = Sys.getenv("R_CONFIGFILE_ACTIVE", "config.cfg"),
extra.list = list(),
other.config = "",
rcmd.parse = FALSE,
bash.parse = FALSE,
glue.parse = FALSE,
glue.flag = "!!glue",
global.vars.field = "global_vars",
file.type = NULL,
...
)
|
file |
File name of configuration file to read from. Defaults to the value of the 'R_CONFIGFILE_ACTIVE' environment variable ('config.cfg' if the variable does not exist and JSON/INI/YAML/TOML format only) |
extra.list |
A list that can replace the configuration file 'debug' by list(debug = 'TRUE'), and debug will be setted to 'TRUE' |
other.config |
Path of another configuration file that can replace the configuration file 'key:value' |
rcmd.parse |
Logical wheather parse '@>@str_replace('abc', 'b', 'c')@<@' that existed in config to 'acc' |
bash.parse |
Logical wheather parse '#>#echo $HOME#<#' in config to your HOME PATH |
glue.parse |
Logical wheather parse '!!glue1:5' in config to ['1','2','3','4','5']; ['nochange', '!!glue(1:5)', 'nochange'] => ['nochange', '1', '2', '3', '4', '5', 'nochange'] |
glue.flag |
A character flage indicating wheater run glue() function to parse (Default is !!glue) |
global.vars.field |
All vars defined in global.vars.field will as the extra.list params [gloval_var] |
file.type |
Default is no need to specify the variable, file.type will be automatically
identify by |
... |
Arguments for |
All values as a list or logical FALSE indicating that is not standard JSON/INI/YAML/TOML format file
fromJSON
JSON file will read by this
read.ini
INI file will read by this
yaml.load_file
YAML file will read by this
parseTOML
TOML file will read by this
1 2 3 4 5 | config.json <- system.file('extdata', 'config.json', package='configr')
config <- read.config(file=config.json)
config.extra.parsed.1 <- read.config(config.json, list(debug = 'TRUE'))
other.config <- system.file('extdata', 'config.other.yaml', package='configr')
config.extra.parsed.2 <- read.config(config.json, list(debug = 'TRUE'), other.config)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.