[R] Space required by object?

jim holtman jholtman at gmail.com
Wed Sep 27 23:42:41 CEST 2006


Here is a function I use:

 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
}


On 9/27/06, Ben Fairbank <BEN at ssanet.com> wrote:
> Does R provide a function analogous to LS() or str() that reports the
> storage space, on disk or in memory, required by objects?
>
> Ben Fairbank
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?



More information about the R-help mailing list