Created
May 29, 2024 12:27
-
-
Save davidtedfordholt/af8e929d3f8d30657c388fe54f8b5d1e to your computer and use it in GitHub Desktop.
print object dimensions and size in R
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 = ",") | |
) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment