I am trying to install the "tm" package but then I get an error saying that "tm" is not available for my R version
package ‘tm’ is not available (for R version 3.0.2)
But then I saw that someone suggested I download the archived version from
http://cran.r-project.org/src/contrib/Archive/tm/?C=M;O=A
and then try installing from source.
My question is how do I determine which file there in the list is compatible with my R version?
You can use the METACRAN mirror:
Go to the blame page of the
DESCRIPTION
file of the package you're interested in.E.g. for
tm
: https://github.com/cran/tm/blame/master/DESCRIPTIONFind the
Depends
line and click as many times as needed on the View blame prior to this change icon, until an old enough R version is displayed.If you want to automate that, it may be better to use crandb (also from METACRAN).
Side note: sometimes package authors list
R (≥ x.y.z)
as a dependency just to be safe because they use versionx.y.z
and didn't do any tests with previous versions.Another option would be to upgrade your version of R so it is compatible with that latest version of the "tm" package. You can do that easily within R by using the following code:
HT: http://www.r-statistics.com/2014/07/r-3-1-1-is-released-and-how-to-quickly-update-it-on-windows-os/
I developed an answer related to the approach here, but which uses only base R (you don't need
XML
ordevtools
or anything). It also potentially handles some contingencies that may not be addressed by the solution I linked to from the other question. Since it was around 100 lines of code, rather than just post a huge function here, I rolled it into a packageoldr
you can get from GitHub here:oldr
package GitHub repoThe package has just one exported function,
install.compatible.packages()
. I have tested it on Ubuntu 18.04. I installed R 3.1.0 and installedtm
(and its dependencies). The current version oftm
requires R 3.2.0, so wouldn't be available viainstall.packages()
, but my function allows its installation:Update: Testing on Windows
I now have also had the chance to test on Windows (8.1), and everything worked smoothly for installing
tm
to an old version of R (v. 3.1.0):Update: Additional Parameters
Now users can specify which version of R to attempt installation for (
R_version
parameter), and which directory to install packages to (lib
parameter), which could be useful for testing or other purposes.You can download the archived package and then untar and un-gzip it. The
DESCRIPTION
file lists the version of R that it needs. In your case the filetm_0.5-10.tar.gz
(that is, the most recent archive version, but not the current version) has this line:Version 0.6 of the tm package updated its dependency to R greater than or equal to 3.1.0.