This has methods for various types of things that may not correctly report their object.size using object\.size. Also, for lists and environments, it will return the object.size separately for each element.

objSize(x, quick)

# S3 method for list
objSize(x, quick = getOption("reproducible.quick", FALSE))

# S3 method for environment
objSize(x, quick = getOption("reproducible.quick",
  FALSE))

# S3 method for default
objSize(x, quick = getOption("reproducible.quick", FALSE))

# S3 method for Path
objSize(x, quick = getOption("reproducible.quick", FALSE))

Arguments

x

An object

quick

Logical. Only some methods use this. e.g., Path class objects. In which case, file.size will be used instead of object.size.

Examples

a <- new.env() a$b <- 1:10 a$d <- 1:10 objSize(a) # all the elements in the environment object.size(a) # different - only measuring the environment as an object
#> 56 bytes