mauede wrote: > > How, if possible, can I run an R script, from command line, passing > external parameters just like > I can run a C main program passing parameters: > > # Cprog p1 p2 p3 > > Cprog can access its arguments (p1,p2,p3) through the built-in structures > "argv" and "argc". > Since R is built on C language I would expect the same feature to be > available with R scripts as well ... ? > Please, notice that I do not mean to open an interactive R session, assign > values to p1, p2, p3 and then > call the R script from the same interactive session. This way I daresay > that p1, p2, p3 would be known to > the R script as global variables. > > Thank you very much. > Maura > >
Command line arguments can be retrieved using the commandArgs() function. For more complicated argument processing, CRAN has the getopt and optparse packages. Good luck! -Charlie -- View this message in context: http://n4.nabble.com/how-to-pass-external-parameters-to-an-R-script-tp1566077p1566487.html Sent from the R help mailing list archive at Nabble.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.