summary: how to write an R script that requires certain 'modules' (in the modules.sourceforge.net sense, not the generic sense)?
details: I'm writing an R script (beginning #!/usr/bin/env Rscript ) that uses a system call to one of the fine NCO tools http://nco.sourceforge.net/ to run on a linux cluster that uses the fine Environment Modules package http://modules.sourceforge.net/ My script works if I remember to do $ module add nco before I run the script; if not, I get sh: <name of tool/>: command not found since the Environment Modules setup paths, etc. So I'm wondering, 1 How best to write a script that both sets up the module and runs my R? Is there an R package that provides modules.sf.net compatibility, so that I can run the whole thing via Rscript? Or should I do a shell script that does something like module add nco R CMD BATCH myscript.r Or something completely different? 2 How to catch failure of system(...) calls, so as to fail fast? (E.g., in case I try to run the R script without setting up the modules first.) TIA, Tom Roche <tom_ro...@pobox.com> ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.