input_yaml: Input values into yaml file

Description Usage Arguments Author(s) Examples

View source: R/input_yaml.R

Description

Inputs values into yaml file by locating the label and key within the yaml file. Preserves comments (#) if present. NOTE: this does not use a yaml parser so if there are yaml formatting errors this function will not pick them up.

Usage

1
input_yaml(file = "gotm.yaml", label, key, value, out_file = NULL)

Arguments

file

filepath; to .yaml which you wish to edit

label

string; which corresponds to section where the key is located

key

string; name of key in which to input the value

value

string; to be input into the key/value pair. Note boolean values must be input as 'true'/'false' as per the yaml format

out_file

filepath; to write the output yaml file (optional); defaults to overwriting file if not specified

Author(s)

Tadhg Moore

Examples

1
2
3
input_yaml(file = 'gotm.yaml', label = 'airp', key = 'file', value = 'met.dat', out_file = 'samp.yaml')
input_yaml(file = 'gotm.yaml', label = 'airp', key = 'file', value = 'met.dat', out_file = 'samp.yaml')
input_yaml(file = 'gotm.yaml', label = 'meteo', key = 'calc_evaporation', value = 'true', out_file = 'samp.yaml')

tadhg-moore/gotmtools documentation built on Oct. 9, 2019, 2:48 p.m.