Skip to content

Instantly share code, notes, and snippets.

View davidtedfordholt's full-sized avatar

David Tedford Holt davidtedfordholt

View GitHub Profile
@davidtedfordholt
davidtedfordholt / obj_size.R
Created May 29, 2024 12:27
print object dimensions and size in R
obj_size <- function(obj, units = 'Mb') {
dimensions <- dim(obj)
data.frame(
rows = format(dimensions[1], big.mark = ","),
columns = format(dimensions[2], big.mark = ","),
size = format(object.size(obj), units = units, big.mark = ",")
)
}