Facing Error in library(caret) : there is no package called ‘caret’ - r

I am facing problem while downloading 'caret' package in R studios. The code below was taken from the caret documentation.
install.packages("caret", dependencies = c("Depends", "Suggests"))
it works fine while installing but it gives Errors and Warnings while unpacking few packages like mentioned below:
ERROR: dependencies ‘eiPack’, ‘ei’, ‘MCMCpack’, ‘Zelig’ are not available for package ‘ZeligEI’
* removing ‘/home/shazil/R/x86_64-pc-linux-gnu-library/3.4/ZeligEI’
Warning in install.packages :
installation of package ‘ZeligEI’ had non-zero exit status
At the end when the whole installation process is finished it says:
The downloaded source packages are in
‘/tmp/RtmpeiP5GO/downloaded_packages’
After that when I use the library() command, the following Error appears
> library(caret)
Error in library(caret) : there is no package called ‘caret’
I am using Ubuntu 16.04,
Dell machine Core i5 7th Gen,
6GB RAM
AMD RADEON GRAPHICS
Would really appreciate the help as I am new to Data Science and R programming.

You need to have both written:
install.packages("caret")
library(caret)

I encountered similar issue when installing caret in MacOS.
The solution was to install devtools and use it to install caret package. Since you are using Ubuntu 16.04,
1.Please refer to this article article to install devtools package.
2.Check the CRAN - caret package for the package URL, then run the code below:
library(devtools)
devtools::install_url("https://cran.r-project.org/src/contrib/caret_6.0-78.tar.gz")
3.If step 2 does not work, alternatively, you can try to install the development version from caret GitHub repo:
library(devtools)
devtools::install_github('topepo/caret/pkg/caret')
Hope these help. Please indicate your R version if these could not work for you.

Related

Unable to install ggm package un R language

I'm currently operating in macOS with the R version of 3.6.3.
When I tried to install the package ggm, a warning occurred as follows.
Warning in install.packages :
dependency ‘graph’ is not available
also installing the dependency ‘igraph’
Then when it completed installing, it seemed not to work either:
ERROR: compilation failed for package ‘igraph’
* removing ‘/usr/local/lib/R/3.6/site-library/igraph’
ERROR: dependencies ‘igraph’, ‘graph’ are not available for package ‘ggm’
* removing ‘/usr/local/lib/R/3.6/site-library/ggm’
What is happening? I have searched for this error and didn't find anything that helps. Please help me. I'll be much appreciated!
I had the same problem.
To install the package graph you need to install the latest version of Bioconductor (i.e. package called BioManager).
Then you install the package graph and then simply run the installation for the ggm package.
install.packages("BiocManager")
BiocManager::install("graph")
install.packages("ggm")
library(ggm)
The package is then loaded into your R enviroment.

Not able to install TwitteR2Mongo Package in R

I am trying to install an R package for autonomous processing of Twitter data with the help of TwitteR2Mongo, but I'm getting the following error:
Warning in install.packages :
package ‘TwitteR2Mongo’ is not available (for R version 3.4.3)
package may not have been published to CRAN. but it builds from github for me on 3.4.3.
try
install.packages("devtools")
library(devtools)
install_github("ProjectTw/TwitteR2Mongo")

Problems trying to install package in R

I am having problems trying to install the nnet package in R. The download seems to be ok, but when I load the library it states
namespace ‘nnet’ is imported by ‘car’, ‘effects’ so cannot be unloaded
In addition: Warning message:
package ‘nnet’ was built under R version 3.2.5
Error in library(nnet) : Package ‘nnet’ version 7.3.11 cannot be unloaded
I tried reading other topics which suggest using remove.packages on car and effects. However I tried this and I am still unable to install
Thanks for the help
Try unloadNamespace('effects') before trying library(nnet).

genderdata package unavailable for R 3.2.3

When I try installing the package "genderdata" to R,
install.packages("genderdata")
I get the following error:
Warning in install.packages :
package ‘genderdata’ is not available (for R version 3.2.3)`
Is there any way around this?
I tried this in my version of R 3.1.1 and got the same error message as you. When I looked closer it also said:
package ‘genderdata’ is available as a source package but not as a binary
I searched around some more and came up with this which worked for me.
options(repos = c("http://packages.ropensci.org/", getOption("repos")))
install.packages("genderdata", repos = "http://packages.ropensci.org", type="source")
I got several warnings but it did install and can be loaded with
library(genderdata)
Try installing from a source that doesn't limit you based on your R version with devtools and github.
install.packages('devtools')
library(devtools)
install_github("ropensci/genderdata")
library(genderdata)

Causes of "Error: package '_____' was built before 3.0.0: please re-install it" in R

On one computer running R 2.15.2 I have installed packages from a .zip file (these packages happened to be ggplot2 and data.table, but I don't think the specific package is my issue.) Everything works fine. I took these packages to a computer without an internet connection and installed them. This other computer is running R 3.0.1. The packages seemed to install without a problem (using R's "install package(s) from local zip file" option). When I call the packages with the library(), I get the following error:
Error: package '<insert name of newly installed package here>' was build before 3.0.0: please-re-install it
Can anyone explain potential causes for this error to be thrown? Are there particular directories that the .zip packages must be in for a proper install? If R is installed on a separate partition from where the .zip packages were loaded, could this cause the error?
I'm at a loss, any pointers are greatly appreciated. This is a difficult one to reproduce; if you need any other version/system parameters to understand the problem, please don't hesitate to ask.
I found this solution while look at GitHub ggplot2 issue #796
update.packages(checkBuilt = TRUE, ask = FALSE)
It will update all the packages that need to be reinstalled.
Running install.packages("codetools") can fix this issue for R 3.0.2, if you have the same problem like me:
installing to /home/user/R/x86_64-pc-linux-gnu-library/3.0/Rcpp/libs
** R
** inst
** preparing package for lazy loading
Error : package ‘**codetools**’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘Rcpp’
ERROR: lazy loading failed for package ‘Rcpp’
I installed shiny according https://github.com/rstudio/shiny-server/wiki/Ubuntu-step-by-step-install-instructions
and got the same error at the step
sudo su - -c "R -e \"install.packages('shiny', repos='http://cran.rstudio.com/')\""
Warning messages:
1: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘Rcpp’ had non-zero exit status
2: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘httpuv’ had non-zero exit status
3: In install.packages("shiny", repos = "http://cran.rstudio.com/") :
installation of package ‘shiny’ had non-zero exit status
I tried the answer by Richard Lee by starting R
R
and got the error
Warning in install.packages("shiny") :
'lib = "/usr/local/lib/R/site-library"' is not writable
Would you like to use a personal library instead? (y/n) n
Error in install.packages("shiny") : unable to install packages
obviously no write permission, so
sudo R
Now I tried again
install.packages("shiny")
and got a number of errors
Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : package ‘RJSONIO’ was built before R 3.0.0: please re-install it
Error : package ‘caTools’ was built before R 3.0.0: please re-install it
Error : package ‘bitops’ was built before R 3.0.0: please re-install it
Error : package ‘digest’ was built before R 3.0.0: please re-install it
Error : package ‘xtable’ was built before R 3.0.0: please re-install it
Each time I got an error, I re-installed the requested package
install.packages("codetools")
install.packages("RJSONIO")
etc.
and eventually, I was able to install Rccp, httpuv, and even shiny.
Now it works!!
Also see
Shiny package installation on R version 3.0.2 "Frisbee Sailing"
I am using rkward on precise
I had a similar error using rkward. Specifically this one:
'lib = "/usr/local/lib/R/site-library"' is not writable
I temporarily changed the permissions for this directory so that rkward could run this from its console:
update.packages(checkBuilt = TRUE, ask = FALSE)
all to fix this:
Error: package '' was build before 3.0.0: please-re-install it
so that (sigh...) I could fix 'default' configuration for audio on precise. I couldn't use play() etc. in rkward.
That just needed phonon-backend-gtstreamer
I tried to install swirl on R(v3.1.0) on ubuntu 12.04LTS:
sudo R
install.packages("swirl")
But faced a similar error:
Error : package ‘codetools’ was built before R 3.0.0: please re-install it
Error : unable to load R code in package ‘httr’
ERROR: lazy loading failed for package ‘httr’
* removing ‘/usr/local/lib/R/site-library/httr’
ERROR: dependencies ‘testthat’, ‘httr’ are not available for package ‘swirl’
* removing ‘/usr/local/lib/R/site-library/swirl’
Doing following helped me:
install.packages('codetools')
install.packages("swirl")
library("swirl")
swirl()
| Welcome to swirl! Please sign in. If you've been here before, use the same
| name as you did then. If you are new, call yourself something unique.
What shall I call you?
I hope the same may help fix your installation issue.
Here is the work-around that I used:
I installed the latest version of R on an internet-capable computer. I then loaded the my required packages (Packages->install packages->select mirror->select package...
After R is finished installing, it displays a message of where the temporary .zip package is located. I navigated to this location, grabbed the temp package, and burnt it to a cd.
In this way, I could get the newer package build onto a computer without internet access. I would still be interested to know if there is an easy way to rebuild a package downloaded on an early R version to make it compatible with the latest version (without needed an internet connection).
Thanks for pointing me in the right direction #JoshuaUlrich

Resources