I've installed the R package tm. Now I am trying to load it, but it's giving me this error and warning everytime, I try.

The package is in this location-


Error Message--

Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) : 
  there is no package called ‘slam’
In addition: Warning message:
package ‘tm’ was built under R version 3.3.1 
Error: package or namespace load failed for ‘tm’

Any thoughts?

  • $\begingroup$ Can you please share the full code, including the suggestions below so that we can see what's going on? It appears to be a missing dependency for slam so if installing slam doesn't change anything that would be highly surprising. $\endgroup$ – Hack-R Aug 30 '16 at 15:23
  • $\begingroup$ Also give your R version and the output from sessionInfo() $\endgroup$ – Spacedman Aug 30 '16 at 15:52
  • $\begingroup$ I have tried all of the above recommendations - reinstalling latest versions of R and RStudio, installing and loading "pacman" package - and I am still unable to load the "slam" package. I am using R 3.3.1 via RStudio on my MacAir with macOS Sierra v10.12. In this regard, I am getting the following error messages regarding installing and REMOVING "slam" y/n: y installing the source package ‘slam’ trying URL 'cran.rstudio.com/src/contrib/slam_0.1-38.tar.gz' Content type 'application/x-gzip' length 49366 bytes (48 KB) ================================================== downloaded 48 KB * $\endgroup$ – user25464 Oct 21 '16 at 17:51
  • $\begingroup$ update r version to latest, it just worked for me. to do this, download latest version of R from cran and install it. no uninstall required for previous versions. Cheers! Manish $\endgroup$ – Manish Mishra Jan 22 '17 at 17:32
  • $\begingroup$ I just make sure all shipping and data information is correct to proceed with the package. $\endgroup$ – Felicia Brookins Feb 16 '17 at 19:03

This is a dependency error. You're just missing one of the packages that tm assumes you have.

One solution is to simply directly install that package:


another is to use a package manager that takes care of this for you:

  • 1
    $\begingroup$ Still getting the same error message. $\endgroup$ – Abhishek Jaiswal Aug 30 '16 at 14:54
  • $\begingroup$ @AbhishekJaiswal Can you show the full code and error with the steps above? $\endgroup$ – Hack-R Aug 30 '16 at 14:56
  • $\begingroup$ @AbhishekJaiswal OP? $\endgroup$ – Hack-R Aug 30 '16 at 15:40
  • 1
    $\begingroup$ Hey, it worked after I reinstalled the R. Meanwhile, thanks for all your help. Cheers! :) $\endgroup$ – Abhishek Jaiswal Aug 31 '16 at 15:38

This is related to the fact that the 'slam' package currently available on CRAN is dependent on a recent version of R (≥ 3.3.1). Updating R will solve the problem.

For those on Ubuntu wishing to keep the R version included in the repository, it is possible to install 'slam' as a package with

sudo apt-get install r-cran-slam

It worked after I reinstalled the R

. So I'll suggest to try doing this if anyone facing the same issue. Two of my mates also solved this issue by following the same approach.


  • 1
    $\begingroup$ True solution to your problem is not reinstalling R however reading the error message. When you tried to install tm you received an error message that slam is not known for the R version that you had. The solution is shown in this excellent post. Please note how this question is formatted. You are highly encouraged to follow the same approach as the OP in that latter question. $\endgroup$ – Stereo Oct 15 '16 at 14:52
  • $\begingroup$ I got your point. I'll consider this for sure in answering any question. Thank you. Cheers! :) $\endgroup$ – Abhishek Jaiswal Oct 15 '16 at 15:10
  • $\begingroup$ It is more about asking the question than answering but great that you got it. $\endgroup$ – Stereo Oct 15 '16 at 15:39

In case someone bumps into the page looking for a solution. This one worked for me:


Now install an earlier version of slam in case you are using an older version of R.

slam_old <- "https://cran.r-project.org/src/contrib/Archive/slam/slam_0.1-37.tar.gz"

Not the answer you're looking for? Browse other questions tagged or ask your own question.