25
votes

I was able to use the library(tm) in r without problem until today, when loading tm shows:

library(tm)

Loading required package: NLP

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :

there is no package called ‘slam’

Error: package or namespace load failed for ‘tm’

I thought this is a dependency issue and seek to reinstall package

install.packages("tm")

Warning in install.packages : dependency ‘slam’ is not available

and then try to find slam:

install.packages("slam")

Warning in install.packages :

package ‘slam’ is not available (for R version 3.2.4)

I also tried some of the issues listed here and chooseCRANmirror(), still no luck. Is there something wrong with the package or is it just that my r does not allow 'slam' to install after today?

session info

> sessionInfo()
R version 3.2.4 (2016-03-10)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.11.6 (El Capitan)

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] NLP_0.1-9

loaded via a namespace (and not attached):
[1] parallel_3.2.4 tools_3.2.4 
13
whats your sessionInfo?Cyrus Mohammadian
Just asked, though not solved: stackoverflow.com/questions/39884276/…alistaire
@CyrusMohammadian thanks for the edits, I have updated the question with my sessionInfo()Carl PCH
I would suggest upgrading to the newest R release.Cyrus Mohammadian
That's odd. The current version of slam on CRAN fails the tests for OS X because with an error that it cannot be installed. r-project.org/nosvn/R.check/r-release-osx-x86_64-mavericks/…pdb

13 Answers

38
votes

For R-version 3.2.3, following worked fine as mentioned in this link and it suggests this works for R-version 3.3.0 as well:

#install devtools if you have not installed 
install.packages('devtools')
library(devtools)

slam_url <- "https://cran.r-project.org/src/contrib/Archive/slam/slam_0.1-37.tar.gz"
install_url(slam_url)
33
votes

I found a hint at this german site about R under Install additional R packages ("Zusätzliche R-Pakete installieren") After I installed slam seperatly over apt-get for example:

sudo apt-get install r-cran-slam

I could install tm the normal way:

install.packages('tm')

And load the library aswell.

I hope my answer helps someone.

5
votes

I had the same problem as you.
Slam "Depends: R (≥ 3.3.1)", this why I had to perform the following actions to successfully install and load "tm" package:

  1. Update R from 3.2.5 to the latest version 3.3.2
  2. install.packages("tm")
    also installing the dependencies ‘NLP’, ‘slam’ package ‘NLP’ successfully unpacked and MD5 sums checked package ‘slam’ successfully unpacked and MD5 sums checked package ‘tm’ successfully unpacked and MD5 sums checked

  3. library(tm)

5
votes

I used the following code to install the binary or the older version of slam. It worked for me.

install.packages("slam", type = "binary")
2
votes

I had the same problem and:

  • I upgraded RStudio to the latest version (1.0.143)
  • I upgraded R to the latest version (R.3.3.3)
  • I rebooted Rstudio
  • I installed again in RStudio the package "tm"
  • I ran library(tm)

and everything works fine now.

2
votes

The latest version of the package "slam" only works for R(>=3.4.0),so you can try either updating your R to the latest version or downloading an early version of the "slam" package.

This is a download link from CRAN for early version of "slam" package: https://cloud.r-project.org/bin/macosx/mavericks/contrib/3.3/slam_0.1-40.tgz.

1
votes

Apparently the problem seems to be the version of R you are using. Try installing the latest version of R, 3.3.1. That should take care of it.

1
votes

I am using R3.2.5. I was trying to install "tm". I did install NLP as a dependency but gave me an error :

"package ‘slam’ is not available (for R version 3.2.5)"

The option I had to was to download the zip/tar/gz file(binaries) from https://cran.r-project.org/web/packages/slam/index.html and install the package. It worked for me after that. Although I am not sure what the problem is because the library information mentions it is for R (≥ 3.3.1)

0
votes

I also had to upgrade to the most recent version of R.

Specifically, on Ubuntu 16.04 here are instructions to get the up to date R version.

0
votes

I faced this error while installing the "tm" package on R version 3.3.0. Seems like some missing libraries. After I could install the latest version 3.4.1 , i was able to install the package "tm" which installed the 'slam' on its own. Hope this may help somebody.

0
votes
  1. Just Install NLP package with dependencies = True

  2. Install tm packaged with dependencies = True

And things should work out:)

0
votes

For Ubuntu, I installed the following two from console and then it got installed.

sudo apt-get install libblas-dev liblapack-dev

sudo apt-get install gfortran

-3
votes

For any such type of issue regarding package not installed, update your R and later reinstall the package. These are the steps you follow:

if(!require(installr)){ install.packages("installr")}

require(installr)}    #load the package

updateR()