Skip to content
Prev 309006 / 398503 Next

problem in finding sizes of objects using a for loop

On Oct 25, 2012, at 10:56 AM, jim holtman wrote:

            
That's far more elegant that the one I use; 

getsizes <-  function() {z <- sapply(ls(envir=globalenv()), 
                                function(x) object.size(get(x)))
               (tmp <- as.matrix(rev(sort(z))[1:10]))}
getsizes()

Only returns the sorted-by-size matrix of the largest ten objects, but modifying it to return all of them should be trivial.