ls.sizes = function(name=parent.frame(), pretty = T, top = 10, ...) { # lists the `top' biggest objects in the given environment x <- sapply(ls(name,...),function(x) object.size(get(x))) if(top > length(x)) top = length(x); x = rev(rev(sort(x))[1:top]) if(pretty) x = format.bytes(x) x <- as.data.frame(x) colnames(x) <- "bytes" x }