I have a new Mac Pro with 64 GB. I have installed almost all R package and it seems my RStudio get slow. Does this has to do with the number of packages I installed and do I need to uninstall some of the packages which I don't need.
When you say you "installed almost all R packages"... that begs the question... why? There are over 17,000 packages on CRAN alone, and between topic disparity (packages that do nuanced things in pharmacology typically are not used by the same people who use packages that do nuanced things in credit risk modeling, for example). So is that actually what you did?
Secondly, I won't hazard much of a guess at R's actual internals when it comes to looking up which packages to use (how does R find dplyr when you say library(dplyr)), but there are only a handful of ways that I can think of where you can pick an item from a collection at a constant speed regardless of the size of the collection, and I am a bit doubtful that those apply here.
Both of these points are to say... install what you need. Use an environment manager like renv if you can.
Maybe you mean you have loaded all packages at once? If so, that would explain slowness. Packages get loaded into RAM memory to be used so if you load them all, you run out of RAM memory and the system suffers.