[R] dynamically including R-code into R-code
ligges at statistik.uni-dortmund.de
Tue Apr 9 20:46:02 CEST 2002
Rik Bradt wrote:
> I have a R-script, R1, that contains some variables and some R-functions.
> I want to include/require this script into another R-script, R2, so that I
> can access the the variables and functions that are inside script R1 in
> script R2.
> Is this possible?
> Script R1 could for example contain information about database
> connections, paths etc.
> that would be used in several R scripts. I do not want to change all my
> every time I change the password of my database for example!
I don't know if I understand your question correctly, but I think
source() should do the job.
Or maybe better: Make a package of the objects in "R1". Then you can use
library(R1) in your script R2.
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
More information about the R-help