Determining memory usage of objects?
I'd like to work out how much RAM is being used by each of my objects inside my current workspace. Is there an easy way to do this?
James C.
answered 09/25/19
I have been an active R user since 2009.
Hi there,
You can easily check the memory of your R objects by downloading and loading the "pryr" package.
Check the following output. Feel free to run the code yourself:
> install.packages("pryr")
> library(pryr)
> set.seed(666) # set a seed for replicability
> x1 <- rnorm(10) # Small object to test
> object_size(x1)
176 B
> x2 <- rnorm(100000000) # large object to test size
> object_size(x2)
800 MB
Still looking for help? Get the right answer, fast.
OR
Find an Online Tutor Now
Choose an expert and meet online.
No packages or subscriptions, pay only for the time you need.