libPaths and posit packagemanager on ubuntu and Rstudio

I have installed R4.5 in ubuntu, foillowed by Rstudio. I have the following questions:

  1. I ran the command in the terminal:
    sudo gedit /etc/apt/sources.list

and then added the following:
deb Ubuntu Packages For R - Brief Instructions noble-cran40/

I would like to know what cran40 stands for. Should I change it to cran45 for R4.5?
2. In Rstudio, I get the following:

.libPaths()
[1] "/usr/lib/R/library" "/usr/local/lib/R/site-library" "/usr/lib/R/site-library"

I would like to know the reason for the 2nd and 3rd locations with site-library? Is there any purpose for them? To change this, I included the following line:

.libPaths(c("/home/rvi/Rlib","/usr/lib/R/library" ))

I ran the command in the terminal:
sudo gedit /usr/lib/R/etc/Rprofile.site

I would first like to know if this is the right file where I should make this change? Or, should it be on a Rprofile.site elsewhere?

The reason I want to make a change to .libPaths is that I want to save my choice of R packages to a folder which I can manage and retain even after I upgrade R to the next version? I do not know if I can do this with the site-library locations.

  1. I want to add the following to the Rprofile.site:

options(repos = c(Posit =
"https://packagemanager.posit.co/cran/__linux__/noble/latest"))

Have I got it right? Once again, I tried to save this to the Rprofile.site indicated above. I have not succeeded in getting R and Rstudio to accept this. What is wrong in my method?

From the CRAN website:

Note that ‘cran40’ denotes a binary compatibility break by the R 4.0.* release, it does not install R 4.0.* but the current R 4.5.* series.

/usr/lib/R/library is the folder where packages that come with the R distribution itself (a.k.a. base R packages) are installed.
Apparently, you have installed R using two different methods in the past, which is why you have two site-library folder locations (i.e., /usr/local/lib/R/site-library and /usr/lib/R/site-library). To check which one is the right one for your current R installation, check your R_HOME environment variable from the R console (Sys.getenv("R_HOME")).
The site-library folder is a package library that is available system-wide, for all users and processes.

That is not necessary, packages don't get deleted when you update R.

There is nothing wrong with the method, but keep in mind that Rprofile.site can be overwritten by an .Rprofile file, which is user-specific. I would look into that.

Thanks a lot, Andres.
Ravi