Arun Kumar Saha
2008-Feb-27 07:03 UTC
[R] Loading user defined functions autometically each time I start R
Hi all, I wrote some user defined function for my own. Now I want to get a mechanism so that every time I start R, those function will automatically be loaded in R without manually copying pasting. Can gurus here pls tell me how to do that? Or I have to build my own packages bundled with those functions. However I am not familiar in writing R package yet. Regards, [[alternative HTML version deleted]]
Arun Kumar Saha
2008-Feb-27 07:17 UTC
[R] Loading user defined functions autometically each time I start R
I am using R 2.6.2. under windows On Wed, Feb 27, 2008 at 12:43 PM, <markleeds@verizon.net> wrote:> >From: Arun Kumar Saha <arun.kumar.saha@gmail.com> > >Date: 2008/02/27 Wed AM 01:03:26 CST > >To: "r-help@stat.math.ethz.ch" <R-help@stat.math.ethz.ch> > >Subject: [R] Loading user defined functions autometically each time I > start R > > i'm on linux so if you are not it's > probably slightly different on windows > but not much. I just put my .Rprofile > file ( you need the . in front but I had to take it > off when I sent you ) in my /opt/mark ( hiome > dorectory on linux ) directory. > > generally speaking, when you ask questions > like that, be sure to specify your OS or > people ( not me ) will get annoyed. > > i you start up R, the .Rprofile should > get called and the functions in your > arun.R file should be available to you. > good luck. > > > I';m no expert so hopefully someone else > will reply also ( that's why i emailed > privately ). > > > > >Hi all, > > > >I wrote some user defined function for my own. Now I want to get a > mechanism > >so that every time I start R, those function will automatically be loaded > in > >R without manually copying pasting. Can gurus here pls tell me how to do > >that? Or I have to build my own packages bundled with those functions. > >However I am not familiar in writing R package yet. > > > >Regards, > > > > [[alternative HTML version deleted]] > > > >______________________________________________ > >R-help@r-project.org mailing list > >https://stat.ethz.ch/mailman/listinfo/r-help > >PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html<http://www.r-project.org/posting-guide.html> > >and provide commented, minimal, self-contained, reproducible code. >-- ---------------------------------------------------------------------------------------------------------------------- Arun Kumar Saha, M.Sc. Statistical Arbitrage Quant RISK MANAGEMENT DIVISION Transgraph Consulting [www.transgraph.com] Hyderabad, INDIA Contact # Home: (91-033) 25558038 [CALCUTTA] Home: (91-040) 40033010 [HYDERABAD] Office: (91-040) 30685012 Ext. 17 [email preferred] FAX: (91-040) 55755003 [if absolutely necessary] Mobile: 919989122010 E-Mail: arunkumarsaha@transgraph.com arun.kumar.saha@gmail.com ---------------------------------------------------------------------------------------------------------------------- [[alternative HTML version deleted]]
anna freni sterrantino
2008-Feb-27 08:35 UTC
[R] Loading user defined functions autometically each time I start R
Hi, an easy way, is to save your functions in a file and have it in your working directoy and sources it. i.e. source("myfile.r") otherwise you can try to build your own package, see ?package.skeleton Hope it helps Regards A ----- Messaggio originale ----- Da: Arun Kumar Saha <arun.kumar.saha@gmail.com> A: "r-help@stat.math.ethz.ch" <R-help@stat.math.ethz.ch> Inviato: Mercoledì 27 febbraio 2008, 8:03:26 Oggetto: [R] Loading user defined functions autometically each time I start R Hi all, I wrote some user defined function for my own. Now I want to get a mechanism so that every time I start R, those function will automatically be loaded in R without manually copying pasting. Can gurus here pls tell me how to do that? Or I have to build my own packages bundled with those functions. However I am not familiar in writing R package yet. Regards, [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org 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. ___________________________________ [[alternative HTML version deleted]]
Richard.Cotton at hsl.gov.uk
2008-Feb-27 10:06 UTC
[R] Loading user defined functions autometically each time I start R
> I wrote some user defined function for my own. Now I want to get amechanism> so that every time I start R, those function will automatically beloaded in> R without manually copying pasting. Can gurus here pls tell me how to do > that? Or I have to build my own packages bundled with those functions.These instructions are for Windows, there may be a slight difference on other platforms. In R_HOME\etc you should have a file named RProfile.site. Inside this file, you can define a .First function, which sources your functions, e.g. .First <- function() { source("c://myfunction.r") } See also: Section 10.8 of the Intro to R manual, and http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_first.html Regards, Richie. Mathematical Sciences Unit HSL ------------------------------------------------------------------------ ATTENTION: This message contains privileged and confidential inform...{{dropped:20}}