write.config: Write config in a file (JSON/YAML/INI)

Description Usage Arguments Value See Also Examples

View source: R/write.R

Description

Write config in a file (JSON/YAML/INI)

Usage

1
2
write.config(config.dat, file.path = Sys.getenv("R_CONFIGFILE_ACTIVE",
  "config.cfg"), write.type = "ini", sections = NULL, ...)

Arguments

config.dat

a list of config (eg. generated by read.config)

file.path

File path of configuration to write. Defaults to the value of the 'R_CONFIGFILE_ACTIVE' environment variable ('config.cfg' if the variable does not exist)

write.type

json/ini/yaml

sections

Sections that need be write in file, default is NULL and use all of sections

...

Arguments for write.ini, prettify, toJSON, as.yaml and cat encoding if not specifield

Value

Logical indicating whether the specified configuration file be writed successful

See Also

toJSON convert a list to JSON string, prettify convert a JSON string to user friendly view, write.ini write a list in a INI format file, as.yaml convert a list to YAML format

Examples

1
2
3
list.test <- list(a=c(123,456))
out.yaml <- sprintf('%s/test.yaml', tempdir()) 
write.config(list.test, out.yaml, write.type = 'yaml')

Miachol/configr documentation built on Nov. 16, 2018, 5:23 p.m.