lssize | R Documentation |
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.
lssize(items, byte = FALSE)
items |
A vector of character strings identifying the objects of interest as would be returned by, e.g. |
byte |
If TRUE, calculate the number of bytes taken up by an object. If FALSE, calculate the total number of elements of an object. |
A vector of the object sizes, with the object names as names for the elements
Carl Witthoft, carl@witthoft.com
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.
lstype
, object.size
, length
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'))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.