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

View source: R/write.R

write.configR Documentation

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

Description

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

Usage

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

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 July 22, 2023, 9:55 a.m.