I am developing a package that exposes an R interface (a bunch of functions to be used interactively) and a command line interface via Rscript. This second one works via a small launcher, for instance, at the command line:
Rscript mylauncher.R arg1 arg2 arg3
would call a function of my package. I would like to test a couple of command lines from R. Nothing fancy, just make sure that everything runs without errors. If I test these calls doing in an R source file:
system("Rscript mylauncher.R arg1 arg2 arg3")
How can I be sure that I called the right Rscript? In case there are multiple R installations? (which is actually the case in my setting). Another approach would be write in the R source file:
source("mylauncher.R")
But I don't see how to specify the command line (I would avoid the trick of overwriting the function "commandArgs", because I want to test also the right tokenization of the command line). Does anybody have an idea?
Thanks!
Aucun commentaire:
Enregistrer un commentaire