-1

I am trying to run a .R script using a YAML config file. What is the syntax within the R console for me to be able to run the R script using an specific YAML config file?

Thanks..

user2040074
  • 634
  • 1
  • 5
  • 16
  • Do you want to parse a YAML file? I'm sorry, but I do not understand what do you mean under "run the R script using an specific YAML config file". – daroczig Nov 15 '14 at 06:05
  • We have functional level code which is contained within a R script (script.R), which employs YAML config files, e.g.: "emr: aws_access_key_id: ? aws_secret_access_key: ? ec2_core_instace_type: ? num_ec2_core_instances: ? r_instances_per_node: ? input: etc.. What would be the syntax to execute the R script using the YAML config file? – user2040074 Nov 15 '14 at 06:08
  • 1
    For parsing YAML, you need the [yaml R package](http://cran.r-project.org/web/packages/yaml/), especially the `yaml.load` function – daroczig Nov 15 '14 at 06:11
  • Right so I have already loaded the yaml R package and execute the steps below in the R console library(yaml) config <- yaml.load_file('location_of_yaml_file') source('location_of_r_script') run Get the error below.. Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") : cannot open file 'NA': No such file or directory – user2040074 Nov 15 '14 at 06:15
  • In addition, when I try to run the script from a terminal using a Rscript I get the error below. Error in file(con, "r") : cannot open the connection Calls: run ... yaml.load_file -> yaml.load -> paste -> readLines -> file In addition: Warning message: In file(con, "r") : cannot open file 'NA': No such file or directory Execution halted – user2040074 Nov 16 '14 at 04:43
  • If you do not post a question with a [minimal reproducible example](http://stackoverflow.com/q/5963269/564164), it's rather hard to help. SO is not a support forum, but you have to do your homework with either reading and interpreting your error/warning messages, or to produce a minimal demo, so that the community can try and debug the problem at localhost. Anyway, in short: I suspect that you have a path issue here. – daroczig Nov 16 '14 at 12:42

1 Answers1

0

I was able to get this working the .The R script creates a function where you can input the config file to use.

Thanks..

user2040074
  • 634
  • 1
  • 5
  • 16