Update to package MASS version 7.3-61 failed on my university Windows 11 desktop running R version 4.3.3.
install.packages("MASS")
Installing package into ‘R:/Home/R/library/4.3’
(as ‘lib’ is unspecified)
Warning in install.packages :
package ‘MASS’ is not available for this version of R
A little investigation reveals that the new MASS version 7.3-61 now seems to require R version >= 4.4.0, probably because MASS 7.3-61 requires Matrix 1.7-0, which now also requires R version >= 4.4.0. I am assuming that these requirements reflect some backward incompatibility of the new R version 4.4.0 with some older package versions.
However, a large fraction of R users have not, and often cannot update their R to 4.4.0 (if they don't have admin privilages on their desktops). The older versions of Matrix (1.6-5) and MASS (7.3.60.0.1) continue to work well on R version 4.3.3 (and probably earlier versions). But the above message returned to someone on an earlier R version is terribly confusing. Further, the error message above doesn't point to information on how to install an appropriate earlier version, which in any case usually requires locating the source for the earlier verson, and then installing from source, rather than a precompiled version. This may not be easy for a non-guru .
Would it be possible to modify install.programs() to look automatically for a version of a package appropriate for the running version of R?
FWIW, this issue doesn't arise with update.packages(), which just ignores an update of a package to a new version requiring a later version of R.
Larry Hunsicker
Unfortunately, this is a difficult problem to solve, as Posit can't really modify the underlying R language (which is where install.packages is coming from). Assuming you're using RStudio, we're just providing a GUI for generating those R functions, we don't control how they behave.
So when it returns Warning in install.packages : package ‘MASS’ is not available for this version of R, I don't think there is a good way for us to 'hijack' the error message to add "...but try Matrix 1.6-5.
One thing you might try is opening a thread on the R mailing lists and see if they have any recommendations of where this type of core language feature request might be appropriate.
# A tibble: 70 × 5
Package Date Version dependencies R_VERSION$type $package $version
<chr> <date> <chr> <list> <chr> <chr> <chr>
1 MASS 2024-01-12 7.3-60.0.1 <df [10 × 3]> Depends R >= 4.0
2 MASS 2024-01-12 7.3-60.2 <df [10 × 3]> Depends R >= 4.4.0
3 MASS 2023-07-13 7.3-60.1 <df [10 × 3]> Depends R >= 4.4.0
4 MASS 2023-07-07 7.3-58.3 <df [10 × 3]> Depends R >= 3.3.0
5 MASS 2023-05-02 7.3-60 <df [10 × 3]> Depends R >= 4.0
6 MASS 2023-04-03 7.3-59 <df [10 × 3]> Depends R >= 4.2.0
7 MASS 2023-01-21 7.3-58.2 <df [10 × 3]> Depends R >= 3.3.0
8 MASS 2022-07-27 7.3-58.1 <df [10 × 3]> Depends R >= 3.3.0
9 MASS 2022-07-14 7.3-58 <df [11 × 3]> Depends R >= 3.3.0
10 MASS 2022-05-29 7.3-57.1 <df [10 × 3]> Depends R >= 3.3.0
# ℹ 60 more rows
and if you use a package manager like renv that can install specific versions via its MASS@version syntax (i.e. renv::install("MASS@7.3-60")
you might be able to cobble together a solution.
you might solve this by install the package of "MASS" locally. In other words, the package should be installed with a new edition in a specific dir of your PC, where you save the file of "MASS_7.3-60.zip" or else.