R Studio library installation directory

I probably didn't follow your issue properly, but you can specify the directory where to install packages.

Check ?install.packages and the lib argument.