2

The thread here is a helpful description of how to change the default library path for the R package if it cannot - or you do not want it to - reside in the default directory assigned during the R installation. Setting R_LIBS_USER in configuration file .Renviron works fine for me under Windows 10.

However, what do you do if nou need to have two different versions of R installed on a local machine (in my case, 3.2 and 4.x)? They need to have different user libraries, don't they? How can I set the default library path in Windwos 10 separately for each R version?

1 Answers1

0

I believe you can do this in the .Rprofile file by adding something similar like:

actualversion = R.version.string
acversionnumber = strsplit(actualversion,' ')[[1]][3]
if(acversionnumber == '4.0.3'){
 .libPaths()[1]
}else{
 libs  <- .libPaths()[1]
 libs1 <- sub('4.0','3.6',libs)
 .libPaths(libs1)
}