How to create config file in r

Hi everyone. I am not able to google some information, or information is written in complex style, however, I am looking for some details: how config file should look like ? I have created a file "config.yml" and inside I included input_source (csv), output (csv), data_directory, results_directory. Based on config file I would like to create a table with filled records (data table, data frame etc). Where can I find information on how to use config file in r, how to properly write config file and what is needed ? Maybe one could recommend some book or provide a www link ?? Thank you very much.

The easiest is to have your config file contain valid R code, then you can simply run source() to execute it. For example with a file that looks like that:

# Indicate csv file
input_source = "/path/to/file.csv"

if you source() it you will have a variable input_source created in R.

Otherwise, the {config} package was created exactly for this purpose, importing values from a config.yml file.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.