[R] dotFirst option

Rolf Turner r.turner at auckland.ac.nz
Thu Jul 31 01:39:29 CEST 2008


On 31/07/2008, at 11:19 AM, Ferry wrote:

> Hi,
>
> I want to plot something the R opens. I created .First as follow:
>
> .First <- function() {
>       plot(rnorm(100))
>       # do other stuff
> }
>
> But instead, I got error like below:
>
> Error in .First() : could not find function "plot"
>
> Any idea?

	.First() gets executed before the startup process has completed,
	in particular before the required packages are loaded.

	I think that one way to solve your problem is to replace
	``plot(rnorm(100))'' by ``graphics::plot(stats::rnorm(100))''.
	(Notice that you'll need to tell it where to find rnorm() as well.)

	I believe there are other ways, involving setting ``hooks'' --- using
	setHook() --- but what this actually means is very obscure (at least I
	have never discovered an adequate explanation of what ``hooks'' are)
	so I won't go there.

			cheers,

				Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}



More information about the R-help mailing list