diff --git a/pkg/R/yaml.load_file.R b/pkg/R/yaml.load_file.R index a98bcea..c975cf9 100644 --- a/pkg/R/yaml.load_file.R +++ b/pkg/R/yaml.load_file.R @@ -12,6 +12,13 @@ function(input, error.label, ...) { error.label <- input[1] } } - yaml.load(paste(readLines(input, encoding = 'UTF-8'), collapse="\n"), + + if(is.character(input)) { + con <- file(input, encoding = 'UTF-8') + on.exit(close(con)) + } else { + con <- input + } + yaml.load(paste(readLines(con), collapse="\n"), error.label = error.label, ...) }