Long listing of R session objects

lldf(
  n = Inf,
  envir = .GlobalEnv,
  items = NULL,
  use_utils_objectsize = TRUE,
  all.names = TRUE,
  ...
)

Arguments

n

integer or Inf indicating how many objects to include in the output data.frame.

envir

environment where the list of objects is obtained. Note this environment is also where objects are evaluated, so the envir and items should be compatible.

items

optional character vector of items to include in the output data.frame. Note that these items should be available in the environment envir.

all.names

logical passed to base::ls() indicating whether to include all names, where all.names=TRUE will include hidden objects whose name begin with "." such as ".First".

...

additional arguments are passed to ls()

Details

This function expands base::ls() by also determining the object size, and sorting to display the top n objects by size, largest first.

This package will call pryr::object_size if available, otherwise falls back to utils::object.size().

Examples

lldf(10);
#>                      name   class bytes   size
#> .Random.seed .Random.seed integer  2552 2.5 kb

# custom environment
newenv <- new.env();
newenv$A <- 1:10;
newenv$df <- data.frame(A=1:10, B=11:20);
lldf(envir=newenv);
#>    name      class bytes      size
#> df   df data.frame   944 944 bytes
#> A     A    integer    96  96 bytes
rm(newenv);