[R] How to read stored functions

Vladimir Eremeev wl2776 at gmail.com
Tue Sep 25 10:15:20 CEST 2007


source'ing is a bad practice because this saves additional copies of
functions and data in the local workspace.

Wasting disk space is not a problem now since HDDs are cheap and function
bodies are generally small.

But, when you change any function body, you have to repeat that source()
call in local workspace of every project using the functions.


Jared O'Connell wrote:
> 
> Having your functions in a text file, say "functions.r" and then calling:
> 
>>source("functions.r")
> 
> is also an option.  This assumes you are in the same directory as "
> functions.r".  Perhaps take a look at ?setwd and ?getwd as well.
> 
> 
> On 9/25/07, Vladimir Eremeev <wl2776 at gmail.com> wrote:
>>
>> You can save your functions to a file with
>> save(<names>,file="/path/to/func_lib.RData")
>> and then attach("/path/to/func_lib.RData").
>>
>> Or, you can create a package and load it with library() or require()
>> 
>> Mauricio Malfert wrote:
>> >
>> > Hi I'm simulating missing data patterns and  I've started to get a lot
>> > of
>> > functions in the same .R file is it possible to store al these
>> functions
>> > in
>> > a library like one does in C++ (i.e the .h file) and read the functions
>> > from
>> > the main .R file
>> > /Mauricio
> 

-- 
View this message in context: http://www.nabble.com/How-to-read-stored-functions-tf4513863.html#a12875031
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list