R/size.R

#' Object size helpers
#'
#' These functions allow you to select variables based on their names.
#' * `size_mb()`: returns size in Mb
#' * `size_gb()`: returns size in Gb
#'
#' These are simple wrapper functions for the code `format(object.size(x,
#' "Mb"))`.
#'
#' @param x Any R object.
#'
#' @name obj_size_helpers
#'
#' @return A string giving the size of the R object.
#' @author Cameron Roach
NULL

#' @rdname obj_size_helpers
#' @export
size_mb <- function(x) {
  format(utils::object.size(x), "Mb")
}

#' @rdname obj_size_helpers
#' @export
size_gb <- function(x) {
  format(utils::object.size(x), "Gb")
}
camroach87/myhelpr documentation built on May 13, 2019, 11:03 a.m.