R and RStudio last update

Hello.
This extremely annoying problem has occurred in the past and is still happening. I'm using Windows 11.
I updated Rstudio to the latest version, 2026.04.0, which already includes the Posit Assistant. Good.
It works with the version of R I have installed, 4.5.2.
Since the new version of R, 4.6, is available, I installed that as well through "installr" package on the R environment (recommended procedure).

  1. Rstudio does not automatically recognize the new version. I have to change it manually.
  2. The new version of Rstudio does not recognize all the packages I had installed in the previous version, even though I confirmed that the new version of R should retain all packages from the previous version. This is the problem: I have to reinstall ALL the packages again. This always happens when R moves from a 4.5.x version to a 4.6 version. Is it a R issue or Rstudio issue?
  3. As soon as I try to use the new version of RStudio with the new version of R, the following error appears:

PT (my language)

Aviso: namespace ‘openxlsx’ não está disponível e foi substituído
por .GlobalEnv ao processar o objeto ‘wb’
Aviso: namespace ‘Rcpp’ não está disponível e foi substituído
por .GlobalEnv ao processar o objeto ‘wb’
[Workspace loaded from C:/folder/folder/.RData]

EN (translation)

Warning: The ‘openxlsx’ namespace is not available and has been replaced
by .GlobalEnv when processing the ‘wb’ object
Warning: The ‘Rcpp’ namespace is not available and has been replaced
by .GlobalEnv when processing the ‘wb’ object
[Workspace loaded from C:/folder/folder/.RData]

Probably because of the packages that aren’t recognized in the new version. Don't know.
It’s fine for me to use the previous version of R 4.5.x, but whenever there’s an update, I have to reinstall ALL the packages, which makes it impractical to work this way.
Any help is welcome.
Thank you.

1 Like

Yes, R 4.6.x packages are not compatible with R 4.5.x packages, you need to reinstall them, preferably into a new package library.

Also, I am not sure where installr is recommended, it tends to create a broken package library, so personally I would not recommend it.

1 Like

This post is about a different topic. Can you please create a new post? Don't forget to add the relevant tags, e.g. rstudio.

2 Likes

If using "installr" is not the correct procedure how can I proceed to update R on Windows 11? Uninstall R and install the new version and after that install Rstudio and the packages? It's impracticable.

You don't need to uninstall R, you can install the new version next to the old one on Windows.

Personally I install packages as needed. But if you are sure that you'll need the same exact packages that you needed before, then you can list the packages in the old version, e.g. with installed.packages() and then install them in the new version.

1 Like

Ok, installing or uninstalling R itself is fine, but the installation process for packages is still annoying and takes a long time. I've used "installed.packages". I understand the evolution being made, but it's a bit strange. They're developing AI for all sorts of complex tasks, yet they're not creating a system that bothers the user as little as possible. Regardless the fact, thank you.

I am not sure why it takes a long time, it should not.

First you run this in old R:

saveRDS(rownames(installed.packages()), "pkgs.rds")

Then you run this in new R:

install.packages(readRDS("pkgs.rds"))

(Packages that you installed from another source and packages that were archived on CRAN should generate a warning only.)

The installation on Windows should not take long, because CRAN has binary packages for Windows. Most of the time should be spent on downloading them, and no amount of smart AI is going to make the downloads faster.

R 4.6.0 has parallel downloads, so it is actually pretty fast. I had 289 packages and it took less than 30 seconds to install them. This was on macOS, but that shouldn't make a huge difference.

1 Like

I will try that because the solution is similar that I've generated with Google Gemini. Thank you.