For R version 3.2.2 (2015-08-14) this problem should be dealt with since R suggests within the installation process a different path to store your R libraries. The installation looks like this:
(Here 'random' is used as an example package)
install.packages('random')
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages("random") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (y/n) y
Would you like to create a personal library
~/R/pc-linux-gnu-library/3.2
to install packages into? (y/n) y
So during the installation answering both questions with 'y' should install the package correctly.
Update 18/01/19
In case you don't want to store your R packages in an additional file:
As Antoine-Sac and Robert TheSim point out you can add yourself to the staff group in order to be able to write to 'site-library'. (Click on the names to see their important additions)
Before this update I mentioned in this comment the option of changing the permission of the folder 'site-library' using 'chmod o+w' in order to be able to write to it. Assuming security issues but unable to tell at the time I warned about it but have primarily been waiting for somone to clear this up. Antoine-Sac and Robert TheSim have done so in the meantime. Thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…