Hi, Just create a file called .Rprofile that is located in your working directory (this means you could actually have different ones in each working directory). In that file, you can put in code just like any other code that would be source()d in. For instance, all my .Rprofile files start with:
r <- getOption("repos") r["CRAN"] <- "http://cran.stat.ucla.edu" options(repos = r) rm(r) So that I do not have to pick my CRAN mirror. Similarly you could merely add this line to the file: source(file = "http://www.r-statistics.com/wp-content/uploads/2010/02/Friedman-Test-with-Post-Hoc.r.txt") and R would go online, download that file and source it in (not that I am recommending re-downloading every time you start R). Then whatever names they used to define the functions, would be in your workspace. Note that in general, you will not get any output alerting you that it has worked; however, if you type ls() you should see those functions' names. Cheers, Josh On Wed, Sep 8, 2010 at 12:25 AM, DrCJones <matthias.godd...@gmail.com> wrote: > > Hi, > How does R automatically load functions so that they are available from the > workspace? Is it anything like Matlab - you just specify a directory path > and it finds it? > > The reason I ask is because I found a really nice script that I would like > to use on a regular basis, and it would be nice not to have to 'copy and > paste' it into R on every startup: > > http://www.r-statistics.com/wp-content/uploads/2010/02/Friedman-Test-with-Post-Hoc.r.txt > > This would be for Ubuntu, if that makes any difference. > > Cheers > -- > View this message in context: > http://r.789695.n4.nabble.com/Saving-loading-custom-R-scripts-tp2530924p2530924.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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. > -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://www.joshuawiley.com/ ______________________________________________ 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.