[R] Saving Newly Created Functions
Thomas Lumley
tlumley at u.washington.edu
Mon Dec 24 17:45:26 CET 2001
On Sat, 22 Dec 2001, Bill Vedder wrote:
> Greetings R-Listers,
>
> Using R1.2.1 (yes, I know...)
>
> I am writing my own functions and would like to know how save these for
> use in subsequent R sessions. How does one do this?
The easiest way is to write them in text files and source() these files.
If you want to do it every time you run R, put the functions or the
source() command in your .Rprofile.
Another possibility is to use save() to put your functions in an Rdata
file. You can then use attach() to make the functions available.
Finally, you can put the functions and their documentation into a package
(following the instructions in 'Writing R Extensions').
The second and third methods mean that the functions won't be part of the
workspace if you save it, and it's easy to unload the functions if you
want to, with detach().
-thomas
Thomas Lumley Asst. Professor, Biostatistics
tlumley at u.washington.edu University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
mailing list