[Rd] Loading a package

Kasper Daniel Hansen kasperdanielhansen at gmail.com
Sun Apr 24 16:17:36 CEST 2011


On Sun, Apr 24, 2011 at 10:08 AM, Orin Richards <oowar at yahoo.com> 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.

Orin

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



More information about the R-devel mailing list