Error in installing packages in R - r

I tried installing rtweet() in R but it shows the following error:
Error: package or namespace load failed for ‘rtweet’ in
loadNamespace(j <- imp[[1L]], c(lib.loc, .libPaths()), versionCheck =
vI[[j]]): there is no package called ‘Rcpp’

As Russ said, you should try to install Rcpp before:
install.packages("Rcpp")
Or you could use the line:
install.packages("rtweet", dependencies = TRUE)
It will install rtweet and all dependencies like Rcpp
You could also, try to install it directly from URL:
install.packages("https://cran.r-project.org/web/packages/rtweet/index.html")
And if still fails, go directly to issues from rtweet (https://github.com/mkearney/rtweet/issues) ;-)
And also be careful, because R packages are case-sensitive!
Have a nice day!

Related

Error: package or namespace load failed for ‘tmap’

I am getting the error below when I am trying to run my shiny app which used to work properly; I did not get this error using the old version of my R/Rstudio. Currently, I am using Version 1.1.463 of Rstudio, and R version 4.0.3.
Thanks,
Nader
Error: package or namespace load failed for ‘tmap’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘raster’
The problem was with installing the ratser. When the question below prompted during the installation, I answered no instead of yes, and this solved the issue. Thanks.
Do you want to install from sources the package which needs compilation? (Yes/no/cancel)

Trouble Installing and Calling R Package

I am trying to install the R package "rattle".
I do so by simply typing:
install.packages("rattle")
...upon which a lot of good installin' seems to take place. But then when I call the package
library(rattle)
I get the error message
Error: package or namespace load failed for ‘rattle’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘stringi’
All of the research I've done online suggests some form of
install.packages("rattle", insert_something_here)
but I've had no luck with such methods.
Any ideas on what I'm missing?
Ok, so the entire issue seemed to revolve around the stringi package.
I first installed the latest Rtools package from
https://cran.r-project.org/bin/windows/Rtools/
and then I was able to successfully install stringi manually
install.packages("stringi")
and then I could call rattle no problem.

Error: package or namespace load failed for ‘rsample’

I'm trying to load rsample package in R but i get this error:
Error: package or namespace load failed for ‘rsample’ in loadNamespace(i,
c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘sfsmisc’
I can't not find a solution to this anywhere.
You can download the source file from here: https://cran.r-project.org/web/packages/rsample/index.html
I also could not get it to install by simply using install.packages ("rsample").
Reading the reference manual, it imports dplyr, purrr, tibble, rlang, methods, and recipes
Once I installed these, I was able to get the library to load from the local rsample_0.0.2.tar.gz file using the following line.
install.packages ("C:/Users/johndoe/Desktop/rsample_0.0.2.tar.gz", repos = NULL, type="source")
try install.packages("sfsmisc")

Error using library(caret) in RStudio

I have been trying to use caret library for a simple ML application. I am using the latest versions of R (3.4.3) and RStudio (1.1.414). Here is my approach
install.packages("caret",repos = "http://cran.r-project.org", dependencies = c("Depends", "Imports", "Suggests"))
when I run the code library(caret) I get the following error
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gower’
Now I went forward and installed the packages that it suggests one by one i.e., DEoptimR, gower, etc. This list never ends as once I install a package it will ask for another package. I am so frustrated. I have literally looked up in every forum but it did not solve my problem. I am not sure why the code install.package does not install all the required packages even though I ask explicitly to do so. when I check .libPaths() I can see it has access to both my library directories
[1] "C:/Users/omid/Documents/R/win-library/3.4"
[2] "C:/Program Files/R/R-3.4.3/library"
would anyone be able to help please?
Edit 1:
install.packages("caret",repos = "https://cran.r-project.org", dependencies = c("Depends", "Imports"))
Installing package into ‘C:/Users/omidm/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
trying URL 'https://cran.r-project.org/bin/windows/contrib/3.4/caret_6.0-78.zip'
Content type 'application/zip' length 5155777 bytes (4.9 MB)
downloaded 4.9 MB
package ‘caret’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\omidm\AppData\Local\Temp\RtmpGuZ1vH\downloaded_packages
library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘gower’
I also uninstalled R and RStudio and installed them again. Still getting the same error.
Solved:
I managed to solve this issue somehow, however, I am still not sure how. here is what I did
Open R GUI (not RStudio) and run:
install.packages("installr") # install
installr::updateR() # updating R
type q() to exit and then open RStudio. Go to Packages and Update all packages
Install package caret as per comments from #chinsoon and #Ronald
install.packages("caret", dependencies=c("Depends", "Imports"))
if you still get an error about any package just install that one. It will not ask for any other packages as you have removed "Suggest" from dependencies. Hope this manages to solve some people's problem.
Easy and simply:
install.packages("gower")
library(caret)
omg! yes ive been trying to find a solution for days! basically install anything it asks. I had to do the following
install.packages("gower")
library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘hardhat’
install.packages("hardhat")
library(caret)
Error: package or namespace load failed for ‘caret’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘parallelly’
install.packages("parallelly")
then ran library(caret) and it worked

How to install package tm in R-3.3.0

I'm using R-3.3.3. I tried to install package tm using following commands
install.packages('tm',dependencies = TRUE)
library('tm')
But I'm getting error message
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘slam’
In addition: Warning message:
package ‘tm’ was built under R version 3.3.3
Error: package or namespace load failed for ‘tm’
I saw two solutions for same type of error here & dependency ‘slam’ is not available when installing TM package. I tried those two but I'm getting error message like
Installation failed: Could not find build tools necessary to build slam.
Kindly suggest me how to install tm package in R-3.3.3
I faced the same problem today, after testing many ways to solve it I could find the following command that can install the tm package, sorry I know it is very late but still useful.
require(devtools)
install_version("tm", version = "0.7-1", repos = "http://cran.us.r-project.org")

Resources