R/size.R

Defines functions size

Documented in size

#' Friendly human readable object size
#'
#' @export
#' @note Updated 2023-08-09.
#'
#' @inheritParams params
#'
#' @return `character(1)`.
#' Object size.
#'
#' @examples
#' x <- c("aaa", "bbb")
#' print(size(x))
size <- function(x) {
    stopifnot(.requireNamespaces("utils"))
    x <- utils::object.size(x)
    x <- format(x, units = "auto")
    x
}
mjsteinbaugh/devtools documentation built on Jan. 5, 2024, 11:09 a.m.