[R] scripts with littler / subroutines

From: John Lawrence Aspden <news_at_aspden.com>
Date: Mon 08 Jan 2007 - 11:43:48 GMT


Hi (again),

Another difficulty I'm having is creating a common function (foo, say) to share between two scripts.

I've tried making a third file containing the function and then sourcing it with source ("foo.R"), but that only works if you run the script in the directory where "foo.R" is. (or if the scripts know where they're installed)

The other solutions that occur are copy-and-paste, a preprocessor, or some sort of special-purpose library. I think I like the preprocessor best, but it's still kind of nasty.

I have the feeling that I'm probably missing something obvious here! Can anyone help?

Cheers, John.

-- 
Contractor in Cambridge UK -- http://www.aspden.com

______________________________________________
R-help@stat.math.ethz.ch 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 Tue Jan 09 04:32:41 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Mon 08 Jan 2007 - 18:30:29 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.