Skip to content
Prev 304973 / 398506 Next

[Rscript] difficulty passing named arguments from commandline

Wanting a commandline solution (for a problem detailed @

http://mailman.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2012/msg00279.html

) I turned to Rscript, and whacked out the q'n'd

https://github.com/TomRoche/GEIA_to_netCDF/blob/master/netCDF.stats.to.stdout.r

However it wasn't as quick as hoped, because I spent quite a bit of time
figuring out how to pass the arguments. This works (note the quoting):

$ Rscript ./netCDF.stats.to.stdout.r 'netcdf.fp="./GEIA_N2O_oceanic.nc"' 'var.name="emi_n2o"'
but this fails

roche at amad1:/project/inf14w/roche/GEIA_to_netCDF $ Rscript ./netCDF.stats.to.stdout.r 'netcdf.fp=./GEIA_N2O_oceanic.nc' 'var.name=emi_n2o'
and this fails

roche at amad1:/project/inf14w/roche/GEIA_to_netCDF $ Rscript ./netCDF.stats.to.stdout.r netcdf.fp="GEIA_N2O_oceanic.nc" var.name="emi_n2o"
and this fails

roche at amad1:/project/inf14w/roche/GEIA_to_netCDF $ Rscript ./netCDF.stats.to.stdout.r netcdf.fp=./GEIA_N2O_oceanic.nc var.name=emi_n2o
Must the quoting be so strict/brittle, or am I missing something?

Also, It Would Be Nice if there was more in the `help(Rscript)` examples
about argument passing. I for one found the current examples quite terse
and unhelpful.

TIA, Tom Roche <Tom_Roche at pobox.com>