[R] Size of an object in workspace

Horace Tso Horace.Tso at pgn.com
Tue Apr 24 17:58:44 CEST 2007


Hi folks,

Is there a function to show the size of an R object? eg. in Kbytes?

Couple months ago Bendix Carstensen posted this marvelous little function lls(), which shows all objects in the current workspace by mode, class and 'size'. This is a wonderful enhancement to the build-in ls() already and I now have it sourced in my Rprofile.site at startup. 

The only drawback is, 'size' is just the length/dim of an object. For matrices and data frames this is good enough. But for a list, knowing how many elements in there doesn't help much. I need to know the totality of the content in a common unit, eg. byte. 

Thanks in advance. 

Horace



More information about the R-help mailing list