Skip to contents

Calculate the size of any R object or directory

Usage

what_size(x = NULL, units = "Mb", path = NULL, recursive = TRUE, ...)

Arguments

x

Object

units

Character. Specify which unit to use, i.e. "Gb", "Mb", "Kb".

path

a character vector of full path names; the default corresponds to the working directory, getwd(). Tilde expansion (see path.expand) is performed. Missing values will be ignored. Elements with a marked encoding will be converted to the native encoding (and if that fails, considered non-existent).

recursive

logical. Should the listing recurse into directories?

...

further arguments passed to or from other methods.

Examples

what_size(seq(1:1e3), "Kb")
#> [1] "4 Kb"
what_size(seq(1:1e6))
#> [1] "3.8 Mb"
what_size(as.character(seq(1:1e6)))
#> [1] "61 Mb"
what_size(path = ".")
#> [1] " Mb"