Hi, I am currently writing some own functions that I frequently need. So, it would be perfect if I could load these functions at the beginning of each R-session with a small command. I tried to generate a R-package and install it that way. But it seems that it is not so easy to add new functions to an existing R-package. So I am not so flexible by that. Is there a way to just load an .R-file which contains the function- definitions with a small command? So that the functions are useable in the current session? I tried load() but I get an error message...
Duncan Murdoch
2009-Jan-20 00:25 UTC
[R] easiest way to integrate own functions on startup
On 19/01/2009 7:13 PM, J?rg Gro? wrote:> Hi, > > I am currently writing some own functions that I frequently need. > > So, it would be perfect if I could load these functions at the > beginning of each R-session with a small command. > > > I tried to generate a R-package and install it that way. > > But it seems that it is not so easy to add new functions to an > existing R-package. > So I am not so flexible by that. > > > Is there a way to just load an .R-file which contains the function- > definitions with a small command? > So that the functions are useable in the current session? > > > I tried load() but I get an error message...load() loads a binary image that was saved by save(). You probably want source(), which reads and executes a file of R source. Duncan Murdoch
Bernardo Rangel Tura
2009-Jan-20 02:14 UTC
[R] easiest way to integrate own functions on startup
On Tue, 2009-01-20 at 01:13 +0100, J?rg Gro? wrote:> Hi, > > I am currently writing some own functions that I frequently need. > > So, it would be perfect if I could load these functions at the > beginning of each R-session with a small command. > > > I tried to generate a R-package and install it that way. > > But it seems that it is not so easy to add new functions to an > existing R-package. > So I am not so flexible by that. > > > Is there a way to just load an .R-file which contains the function- > definitions with a small command? > So that the functions are useable in the current session? > > > I tried load() but I get an error message...Hi J?rg, I do you not use .Fisrt. Something like this: .First <- function(){ source(MyFunction1.txt) source(MyFunction2.txt) source(MyFunction3.txt) ... source(MyFunctionn.txt) } -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil