Installing Caret and ggplot2 packages in R 3.2.5 - r

I've just installed a new version of R studio 3.2.5 that way I can install packages caret and ggplot2 however I always come across the same errors and not exactly sure where the problem is.
library(caret)
Loading required package: lattice
Loading required package: ggplot2
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package ‘ggplot2’ could not be loaded**
After this message I've install.packages("ggplot2")
and this shows up
library(ggplot2)
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
there is no package called ‘Rcpp’
Error: package or namespace load failed for ‘ggplot2’**
Does anyone have any suggestions?

try this
install.packages("ggplot2", dependencies = TRUE)

I have also got the same error and i tried many ways given in various solutions.
one solution which worked is
install.packages("stringi")
Then it many give errors stating some of the dependent libraries are missing.
Install those libraries, it will work.

Related

Need help loading sjPlot package in R

I am trying to use the plot_model function to fit a GLM. I am able to install sjPlot using the install.packages function. However, when I use library(sjPlot), I get this:
Error: package or namespace load failed for ‘sjPlot’ in loadNamespace(j <- i[[1L]],
c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘tibble’ 1.4.2 is already loaded, but >= 2.0.0 is required
Thanks
Have you tried updating your packages as suggested here?
Try running:
update.packages()
And then re-loading the library:
library(sjPlot)

"Forecast" package in R couldn't be executed

Previously, I had used this same package with the very same data. Today, I installed couple of neural network package in R. I noticed that after installing the new package, I can no longer execute the "forecast" package. There is some package missing, which I had re-install again. And the last one, I had this warning message. Is there anyone had any idea what it was?
library(forecast)
Error: package or namespace load failed for ‘forecast’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
namespace ‘pkgconfig’ 2.0.1 is being loaded, but >= 2.0.2 is required
In addition: Warning message:
package ‘forecast’ was built under R version 3.4.4
I had try to re-install the "forecast" package but still I got some error message. Thank you so much in advance.
By #andresrcs(Sustainer)
Jul 6
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]) :
namespace ‘pkgconfig’ 2.0.1 is being loaded, but >= 2.0.2 is required
This is telling you that you have to update this package dependency, try installing it first with
install.packages("pkgconfig")
If everything goes well, then you can try to install ggplot2 again, but this time try with this command
install.packages("ggplot2", dependencies = TRUE)

md.pattern() does not work after library(mice)

I just wanted to learn how to deal with missing value. I found the mice package, but if I run install.package and library R cannot find md.pattern. Does anybody know why?
install.packages("mice")
library(mice)
md.pattern(data)
Error in md.pattern(data) : could not find function "md.pattern"
library(mice)
Loading required package: lattice
Error: package or namespace load failed for ‘mice’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘minqa’
In addition: Warning message:
package ‘mice’ was built under R version 3.4.4
Search mice from the part where we installed all packages and ☑️mice from the packages .it will work.

error loading packages R, almost all packages

Today I opened R as usual and loaded all my libraries as usual, however most of my packages report an error now!
For example
library(ggmap)
> library(ggmap)
Loading required package: ggplot2
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]):
there is no package called ‘lazyeval’
Error: package ‘ggplot2’ could not be loaded
I have never had this error before or encountered the package 'lazyeval'.
The story is similar for many other packages:
library(lubridate)
Error: package or namespace load failed for ‘lubridate’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘stringi’
Somehow it seems that I need to install all packages again?
Any idea what happened? As far as I know nothing has changed since I used R yesterday..

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

Resources