Just a toy to list the number of elements or optionally the bytesize as produced with object.size of a specified selection of objects. I find it handy when I want to rid an environment of large (or empty) objects. In the default case, byte=FALSE , lists and S4 objects are "taken apart" down to the lowest level so all individual elements are counted.
Usage
lssize(items, byte = FALSE)
Value
A vector of the object sizes, with the object names as names for the elements
Arguments
items
A vector of character strings identifying the objects of interest as would be returned by, e.g. ls(pattern="foo") or lstype("double") .
byte
If TRUE, calculate the number of bytes taken up by an object. If FALSE, calculate the total number of elements of an object.
Many thanks to Martin Morgan of bioconductor.org who provided the recursive function for deconstructing an S4 Object. See http://stackoverflow.com/questions/14803237/ for the original question and answer.
x1<-runif(100)
x2<-runif(1000)
x3<-runif(2000)
lssize(ls(pattern='x[1-3]'))
lssize(ls(pattern='x[1-3]'),byte=TRUE)
#depending on what you have in your environment:lssize(lstype('integer'))