Re: [R] how to source file with arugments

From: Dieter Menne <dieter.menne_at_menne-biomed.de>
Date: Thu, 06 Nov 2008 07:11:32 +0000 (UTC)

Jiqiang Guo <guojq28 <at> gmail.com> writes:

> As we know when we use R to execute a r program we can add arguments like
> '--args p1 p2'. But when I am sourcing another file, is there a way to set
> up some arguments for the sourced program. Thanks!
>

In general, you can use Sys.getenv() and .setenv() to pass parameters from the command line.

passw=Sys.getenv("PASSW")

But when sourcing, why not simply use R?

mypass = "secret"
source("myfile.r")

Dieter



R-help_at_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. Received on Thu 06 Nov 2008 - 07:13:24 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 06 Nov 2008 - 07:30:25 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive