[R] scripts with littler / subroutines

John Lawrence Aspden news at aspden.com
Mon Jan 8 12:43:48 CET 2007


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



More information about the R-help mailing list