diamonds <- ggplot2::diamonds
pryr::object_size(diamonds)
#> 3.46 MB
diamonds2 <- transform(diamonds, price_per_carat = price / carat)
pryr::object_size(diamonds2)
#> 3.89 MB
# Size of both data frames combined
pryr::object_size(diamonds, diamonds2)
#> 3.89 MB
Last active
June 27, 2016 00:07
-
-
Save hadley/e4cfe72fc85f7a7cbac0 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@decisionstats how much bigger do you see? I see 0.0006 MB bigger for one extra internal attribute of fixed size. Unless perhaps your data.table has had an automatic index added. DT[ someCol == someVal, ] does that by default for convenience and instant lookup if someCol is queried again. In which case both base::object.size() and pryr::object_size() will include the size of the data.table index which is added as an attribute.