What error message were you getting @Anantadinath?
My strategy is to read error messages.
Most of the time, if I encounter a problem with a package, it is during installation (package does not install). I am not sure what it looks like when installing packages from within RStudio, but I imagine that the console probably displays the same output that would show if installing straight from within R? If so, check what is happening when packages are being installed. It isn't just jiberish. It is really useful information. I don't want to give recommendations about RStudio, but it might be better to install packages directly in R anyway (rather than RStudio). I use another interface to R, but when I install, update, remove, re-install packages, I do it in a session with administrative privilege and I do it directly in R.
When installations fail, this is given at the end, with a warning. But if this happens while installing or updating several packages, the relevant information can be thousands of line up. So I usually keep an eye on what is happening during install and when a line starting with "ERROR:" pops up, I stop the screen by clicking on it. This is where R will tell you that the installation of x
failed because it could not load y1
for instance (maybe because it was compiled under another version of R). So now I know that I need to recompile y1
. And maybe I will get an "ERROR:" then again, because z3
also needs to be recompiled. It can be a little tedious, but the info is all in there. With the release of R 3.5 for instance, since many packages needed to be recompiled, I kept running into chains of dependencies. So I opened a little text file in which I wrote: x: y1: z3
, etc. Meaning that when trying to install x
, it failed because of y1
. And when trying to install y1
, it failed because of z3
, etc. Eventually, you get to a package that successfully installs, so you can start "walking" that chain back up towards x
.
It is extremely rare when I encounter a problem with a package that successfully installed. But there again, the answer is in the error message. I can in fact only recall one such instance and it was with lintr
. The error message was:
Error in dyn.load(file, DLLpath = DLLpath, ...) :
unable to load shared object '/usr/lib/R/library/stringi/libs/stringi.so':
libicui18n.so.60: cannot open shared object file: No such file or directory
This error tells me that the issue has to do with the package stringi
. I re-installed stringi
and the problem was fixed.
When installing packages from a command line (R or otherwise), it might feel overwhelming to see thousands of lines of stuff scroll down at high speed. It is easy to think of it all as unintelligible stuff. But it is not. And things like "ERROR", "can not load ...", "package was compiled under another R version", etc. do make sense.