Re: [Rd] Loading a package

From: Kasper Daniel Hansen <>
Date: Sun, 24 Apr 2011 10:17:36 -0400

On Sun, Apr 24, 2011 at 10:08 AM, Orin Richards <> wrote:
> Hello All,
> I heard of the First() function in R. but am not sure entirely how it is used.
>  I would like to load an R package at startup, instead of having to manually
> load each time I run R. How is the first() function used to achieve this .
> Specifically I would like to tell R at startup to look in a specific folder for
> the package and load it.
> Is there a way to do this, and is there any code sample code avail for this.


Is this for a package (in which case you solve it by using Depends) or is it in general for your usage? If the later, you can put code into ~/.Rprofile which is essentially an R script that gets run every time you start R. The code in the file would be something like   library(PKGNAME, lib.loc = "DIR")

Kasper mailing list Received on Sun 24 Apr 2011 - 14:20:08 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 24 Apr 2011 - 19:10:51 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive