[R] Unintended loading of package:datasets

David Winsemius dwinsemius at comcast.net
Mon May 11 02:00:55 CEST 2009


On May 10, 2009, at 7:33 PM, Rolf Turner wrote:

>
> On 11/05/2009, at 9:17 AM, David A Vavra wrote:
>
>> 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
>
> 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.


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
  }

-- 

David Winsemius, MD
Heritage Laboratories
West Hartford, CT




More information about the R-help mailing list