Skip to content

Unintended loading of package:datasets

6 messages · David A Vavra, Rolf Turner, David Winsemius +1 more

#
The dataset package is being loaded apparently by one of the packages that I
am using. The loading of the datasets takes a long time and I would like to
eliminate it. I thought the datasets were effectively examples so don't
understand why they would be required at all.

1) How can I determine what is causing the datasets to be loaded?
2) How can I stop them from doing so?

I am using the following:

Rpart, grDevices, graphics, stats, utils, methods, base
There is also an environment named 'Autoloads'

TIA
#
On 11/05/2009, at 9:17 AM, David A Vavra wrote:

            
The datasets (note the ``s'') is a required R package which is  
*always* loaded
automatically --- and in my experience instantaneously.

I don't know about a dataset (singular) package.  There does not  
appear to be
one on CRAN.

There is some confusion in what you are doing.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:9}}
#
On May 10, 2009, at 7:33 PM, Rolf Turner wrote:

            
My guess is that she has created a large object in .Rdata that she  
does not remember. The way forward would be to use one of the several  
implementations of ls() that report size. Searching on"
  ls object size

...in the r-search pages may offer ideas.

<http://search.r-project.org/nmz.html>

Here is one that Jim Holtman offered earlier this year:

my.ls <-
  function (pos = 1, sorted = F)
  {
  .result <- sapply(ls(pos = pos, all.names = TRUE), function(..x)
object.size(eval(as.symbol(..x))))
  if (sorted) {
  .result <- rev(sort(.result))
  }
  .ls <- as.data.frame(rbind(as.matrix(.result), `**Total` =  
sum(.result)))
  names(.ls) <- "Size"
  .ls$Size <- formatC(.ls$Size, big.mark = ",", digits = 0,
  format = "f")
  .ls$Mode <- c(unlist(lapply(rownames(.ls)[-nrow(.ls)],
function(x) mode(eval(as.symbol(x))))),
  "-------")
  .ls
  }
#
Thanks. Perhaps something else is going on. There is a large time period
(about 20 sec.) after the message about loading the package. More
investigation, I suppose.

Thanks again,
DAV


-----Original Message-----
From: Rolf Turner [mailto:r.turner at auckland.ac.nz] 
Sent: Sunday, May 10, 2009 7:34 PM
To: David A Vavra
Cc: r-help at r-project.org
Subject: Re: [R] Unintended loading of package:datasets
On 11/05/2009, at 9:17 AM, David A Vavra wrote:

            
The datasets (note the ``s'') is a required R package which is  
*always* loaded
automatically --- and in my experience instantaneously.

I don't know about a dataset (singular) package.  There does not  
appear to be
one on CRAN.

There is some confusion in what you are doing.

	cheers,

		Rolf Turner

######################################################################
Attention:\ This e-mail message is privileged and confid...{{dropped:13}}
#
G'day David,

On Sun, 10 May 2009 17:17:38 -0400
"David A Vavra" <davavra at verizon.net> wrote:

            
help(options)
and then read the part on "defaultPackages"
Create an appropriate .Rprofile.  R-DownUnder had long time ago a
discussion on what people put into their .Rprofile,  and Bill
Venables' .Rprofile seem to contain the following snippet:

### puts four more packages on to the default
### search path.  I use them all the time
local({
  old <- getOption("defaultPackages")
  options(defaultPackages = c(old, "splines",
            "lattice", "mgcv", "MASS"))
})
Rpart??  Or rpart??  I know of a package with the latter name but not
the former, and R is case sensitive.

So you may try:

local({
  options(defaultPackages=c("rpart", "grDevices", "graphics", "stats",
           "utils", "methods")
})

FWIW, note that for command XXX, help(XXX) will give you a help page
that has usually some example code at the end, that code can be run by
example(XXX).  Typically, such example code is using data sets from
the datasets package; so if you do not load it, the example() command
might not work anymore for some functions.  

Don't complain if your R installation doesn't work anymore if you mess
around with defaultPackages, in particular if you remove packages that
are usually in the default of defaultPackages. :)

And I agree with Rolf (Turner), it is hard to believe that the
datasets package would produce a noticeable delay on start-up; for me
it also loads instantaneously.  I guess that your problem is more
along David's (Winsemuis) guess. 

Cheers,

	Berwin
#
G'day David,

On Sun, 10 May 2009 21:35:30 -0400
"David A Vavra" <davavra at verizon.net> wrote:

            
What R version are you using?  I do not remember ever getting a message
that the package datasets is loaded, nor a message for any of the other
packages that are loaded by default.  (There once, long ago, may have
been such a message, but if so, I do not remember this anymore.)

Cheers,

	Berwin