installing 2 ggplot in R and getting an error - r

i am trying to install ggplot 2 into R . The instalation works well but when i write:
library("ggplot2")
i get an error:
Error: package or namespace load failed for ‘ggplot2’ in loadNamespace(i, c(lib.loc,
.libPaths()), versionCheck = vI[[i]]):
there is no package called ‘lifecycle’
i looked online to find any help, restarted R nothing worked.
i insataled the lifrcycle package didnt help at all.
instald ggplot2 from the tool bar how can i fix this ?
thank you :)

Related

can't load package kknn in r studio

looks like the package has been successfully installed, however, the below message keeps appearing:
Error: package or namespace load failed for ‘kknn’ in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = vI[[j]]): there is no package called ‘lattice’
The kknn package was successfully installed before today. But I can't knit the document to pdf, so I installed a package called latexpdf. After that, the whole RStudio just doesn't function well. I don't know what happened... tried to re-install but doesn't help.
Does anyone know what should I do with this? thank you!
Thanks for the modification!
I installed Lattice package and the problem solved...what a silly question...

error message when adding snippets package to my R library

I'm trying to make use of the R package "snippets." So, I seem to have installed it ok:
> install.packages("snippets", , "http://rforge.net/")
But then, when I go to add it to my library, I get the following error message:
> library(snippets)
Error: package or namespace load failed for ‘snippets’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘png’
I'm lost after that. Anyone know what to do?
Jerry

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

Installing Caret and ggplot2 packages in R 3.2.5

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.

Error in require(biwavelet)

I have just downloaded biwavelet package but when trying to open it in R version 3.1.2 i get this error message:
> library(biwavelet)
Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
there is no package called ‘spam’
Error: package or namespace load failed for ‘biwavelet’
It only happens with this package. Any clues about what is the problem here?
It seems to be missing a dependency somehow. Just run
install.packages("spam")
to install the missing package.

Resources