Reputation: 812
Whether I want to load a package that contains a function that I want versus writing my own function depends largely on the size of the package. How I can get the size of the package (without looking through my directories) with code? Also, is there code that can tell me how much memory each of my loaded/attached packages are taking up in my workspace?
Upvotes: 6
Views: 1062
Reputation: 3914
Loading packages does not take much memory. You can use mem_used()
function from package pryr
to estimate the memory growth with each package being loaded:
library(pryr)
mem_used()
# 74.1 MB
library(dplyr)
mem_used()
# 77 MB
library(data.table)
mem_used()
#78.2 MB
Upvotes: 8