linux – R “RPostgrSQL” package fails to install on Centos 8 (as `lib` is unspecified)

I want to install the R package RPostgresql to connect to my database on Centos 8. When I run

> install.packages("RPostgreSQL")

in the terminal I get the following error:

Installing package into ‘/usr/lib64/R/library’
(as ‘lib’ is unspecified)
Warning in install.packages("RPostgreSQL") :
  'lib = "/usr/lib64/R/library"' is not writable
Would you like to use a personal library instead? (yes/No/cancel)

From the message I am gathering that I need to setup a personal library but I am not sure about the implications. What I am trying to do is run a r script e.g. new.r that will be called from another bash script.



pw <- {

drv <- dbDriver("PostgreSQL")

con <- dbConnect(drv, dbname = "crex",
                 host = "localhost", port = 5432,
                 user = "postgres", password = pw)

dbExistsTable(con, "work")

Can someone please help on this?