使用installR更新R时遇报错,求升级至R 3.4.4的解决方法
Hey there, let's break down what's happening here first: that error message tells you your current R version is older than 3.4.4, and the installr package you're trying to use was built specifically for R 3.4.4. Since older R versions can't run packages built for newer releases, installr won't work as intended right now.
Here are two solid approaches to fix this and get your R version updated:
Option 1: Manually Upgrade R to 3.4.4 (Most Reliable)
Since installr isn't usable in your current setup, manual upgrade is the way to go. Follow these steps:
Backup your installed packages first: You don't want to lose all your work! Run these commands in your current R session:
# Save your current workspace (optional but helpful) save.image("my_workspace.RData") # Export a list of all installed packages write.csv(installed.packages()[, c("Package", "Version")], "my_packages.csv", row.names = FALSE)Download R 3.4.4: Head to the CRAN archives and grab the installer for your operating system:
- For Windows: Look for the
.exefile labeled "R-3.4.4-win.exe" - For macOS: Grab the
.pkgfile (note: macOS versions might have specific system requirements) - For Linux: You can either download the source tarball or use your system's package manager to install the 3.4.4 release (you may need to add a repository with older R versions)
- For Windows: Look for the
Install the new version: Close all open R/RStudio windows first. Run the installer, and choose to overwrite your existing R installation (this is the easiest option—you can keep old versions if you want, but overwriting simplifies things).
Restore your packages: Open the newly installed R 3.4.4, then run:
# Load your package list pkg_list <- read.csv("my_packages.csv") # Reinstall all packages install.packages(pkg_list$Package)If some packages fail to install (because they no longer support R 3.4.4), use
devtools::install_version()to grab a compatible version of that package. For example:# Install devtools first if you don't have it install.packages("devtools") devtools::install_version("dplyr", version = "0.7.8") # A version compatible with R 3.4.4
Option 2: Install a Compatible Version of installr (If You Prefer Using the Package)
If you really want to use installr for the upgrade, you need to install an older version of installr that works with your current R version first. Here's how:
First, install the
devtoolspackage (if you don't already have it):install.packages("devtools")Then, install an older
installrrelease that's compatible with your current R version. For example, version 0.20.0 ofinstallrworks with R versions as low as 3.1.0:devtools::install_version("installr", version = "0.20.0")Once that's installed, you can run
installr::updateR()to upgrade to R 3.4.4 (or a newer version if you prefer).
Quick Notes
- After upgrading R, if you use RStudio, restart it to make sure it recognizes the new R version.
- Avoid copying packages from your old R library to the new one—this can cause compatibility issues. Reinstalling is safer.
内容的提问来源于stack exchange,提问作者Angus

