Skip to content

Instantly share code, notes, and snippets.

@ramhiser
Created September 29, 2014 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ramhiser/040b320e6be0711e7c70 to your computer and use it in GitHub Desktop.
Save ramhiser/040b320e6be0711e7c70 to your computer and use it in GitHub Desktop.
Object Size of R Objects in Memory
library(dplyr)
objects <- ls()
object_sizes <- sapply(objects, function(x) object.size(get(x)))
object_sizes <- data.frame(objects, object_sizes, row.names=NULL)
object_sizes$units_MB <- utils:::format.object_size(object_sizes$object_sizes, units="Mb")
dplyr::arrange(object_sizes, object_sizes)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment