Re: [R] on attach/load of a *package*; was creating library

From: Uwe Ligges <ligges_at_statistik.tu-dortmund.de>
Date: Thu, 29 May 2008 17:30:18 +0200

yoooooo wrote:
> Hi,
>
> I'm able to create a library with R CMD INSTALL cmd, etc... I'm just

You probably mean you are able to *install* a *package*, I guess.

> wondering.. is it possible that when the user says library(boo), it runs
> some initialization code?

Yes: See the manual writing R Extensions and ?.onLoad and ?.First.Lib (depending whether you have a Namespace defined or not).

Uwe Ligges

> I have a dumb R file that is:
>
> print(2)
> boo <- function(x){}
>
> when I R CMD INSTALL the library, I'm able to see 2 in my unix console..
> but when I do
>
> library(boo)
>
> in R afterwards.. I don't see the 2, but the boo function is there. Is
> there anyways to have the library to run some initialization code when
> loading? Thanks!
>
> - yoooooooo



R-help_at_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. Received on Thu 29 May 2008 - 17:11:40 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 Thu 29 May 2008 - 17:30:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive