lssize: List the sizes of all selected objects.

Description Usage Arguments Value Author(s) References See Also Examples

Description

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

1
lssize(items, byte = FALSE)

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.

Value

A vector of the object sizes, with the object names as names for the elements

Author(s)

Carl Witthoft, carl@witthoft.com

References

Many thanks to Martin Morgan of bioconductor.org who provided the recursive function for deconstructing an S4 Object. See http://stackoverflow.com/questions/14803237/is-there-an-s4-equivalent-to-unlist for the original question and answer.

See Also

lstype , object.size, length

Examples

1
2
3
4
5
6
7
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'))


Search within the cgwtools package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.