Unable to install packages in R console - r

I am getting the following error when installing packages in R , can anyone please provide me a solution for this? I have tried the solutions posted on other posts but none of it has helped.
install.packages("ggplot2")
--- Please select a CRAN mirror for use in this session ---
Warning: failed to download mirrors file (cannot open URL 'https://cran.r-project.org/CRAN_mirrors.csv');

You can try
install.packages('ggplot2', repos = 'http://cran.us.r-project.org')

Related

How to Install mlr3extralearners in R?

So I am going to do some survivalsvm process and I need the mlr3extralearners package from GitHub. When I tried to install it locally using the tar.gz file, it said
Execution halted
Warning in install.packages: installation of package had non-zero exit status
I also tried to use the zip file, and it said
install.packages("C:/Users/Ivan/Downloads/mlr3extralearners-0.5.49.zip", repos = NULL, type = "win.binary", lib="C:/R-4.2.1/library")
then nothing happened.
I also tried using devtools::install_github("mlr-org/mlr3extralearners"), but the output was the same when I used the tar.gz file. When I checked in my library, I already have the mlr3extralearners package, but when I call it using library(mlr3extralearners), it does not work. Does anyone know how to solve this? Any help is appreciated.
https://rdrr.io/github/mlr-org/mlr3extralearners/
I believe this should work for you:
Install the latest version of this package by entering the following in R:
install.packages("remotes")
remotes::install_github("mlr-org/mlr3extralearners")

Errors downloading R package for "Efficient R Programming" by Gillespie and Lovelace

the above-referenced book has an associated R package hosted on github containing datasets and functions used in the book.
The book states this code is used to install the package:
devtools::install_github("csgillespie/efficient", build_vignettes = TRUE, dependencies = TRUE)
I receive the following message and errors when running the code:
SUMMARY: processing the following file failed:
'solutions07.Rmd'
Error: Vignette re-building failed.
Execution halted Error: Failed to install 'efficient' from GitHub:
System command 'Rcmd.exe' failed, exit status: 1, stdout & stderr were printed
Do you have any insight into whether the package itself is causing the error versus a local issue on my end? Or how I might figure out the cause and fix for this issue? I appreciate any help you can provide.
This URL provides the section in the online book I am referring to.
https://csgillespie.github.io/efficientR/introduction.html#book-resources
If I run the following code it works:
devtools::install_github("csgillespie/efficient", build_vignettes = TRUE, dependencies = TRUE)
devtools::install_github("csgillespie/efficientR")
I would suggest to reinstall the devtools package using the following code:
remove.packages("devtools")
install.packages("devtools", dependencies = TRUE)
library(devtools)
Was having the same problem. But after installing Rtools for windows: https://cran.rstudio.com/bin/windows/Rtools/rtools42/rtools.html
And installing from source packages that were recommended to update:
recommended packages
Was able to succefully use efficient, and access its vignettes.
Using version R-4.2.1
devtools version 2.4.5

Trying to install library 'quantmod' in R

I'm trying to download library 'quantmod' in R:
install.packages("quantmod")
console:
The downloaded source packages are in
‘/tmp/RtmpwSKGIl/downloaded_packages’
then:
library("quantmod", lib.loc="/tmp/RtmpwSKGIl/downloaded_packages")
console:
Error in library("quantmod", lib.loc = "/tmp/RtmpwSKGIl/downloaded_packages") :
there is no package called ‘quantmod’
What is the problem?
I get no problem when I try to load this package.Have you tried to provide R the full name path to your package file directory ?C:/Users/...Is your R version up to date ? Try to check if you have the latest, I tried and it worked with :
R 3.3.3
If you are a Windows or MAC user you might want to force the download of the package from source to binary, this can be done by setting the right options in the install.packages command:
options(install.packages.check.source = "no")
https://stat.ethz.ch/R-manual/R-devel/library/utils/html/install.packages.html
I guess I am a year late, but just got out of this situation by installing the Package from R (instead of RStudio) by changing the CRAN.
You can then run library(quantmod) in Rstudio. Hope this works(worked?) for you too.
I am ready to go now!

unable to install gganimate package from Github, both automatically and manually

I am currently trying to install the gganimate package but seem unable to.
I am running Win 10, Rx64 3.3.0 and Rstudio 0.99.896;
the following command:
devtools::install_github("dgrtwo/gganimate")
will throw this error:
Downloading GitHub repo dgrtwo/gganimate#master
from URL https://api.github.com/repos/dgrtwo/gganimate/zipball/master
Error in curl::curl_fetch_memory(url, handle = handle) :
Problem with the SSL CA cert (path? access rights?)
So after a few hours of despair, I decided to try and install the package manually. I followed this link:
here
the following command:
install.packages(pkgs = "C:/Users/Superzucca/Desktop/gganimate-master.zip", repos = NULL)
results in:
Installing package into ‘C:/Users/Superzucca/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
but then when I call:
library("gganimate-master") #### -> as suggsted by R itself!!
this error is thrown:
Error in library("gganimate-master") : there is no package called ‘gganimate-master’
please, help. I don't have any problems installing other pkgs and honestly don't know what else to try.
Thank you in advance,
Superzucca
Try out this. It's working for me.
library(devtools)
library(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
devtools::install_github("dgrtwo/gganimate")
Figured out the problem, updating with an answer if anybody in the future might need it.
this LINK to another SO question partially solved my problem;
I also had to add R, Rstudio and the library folder to my AntiVirus' excption list, and of course running as administrator :)
I had the same problem like you but I was successful at last.
Generally, you have to deal with two issues: first, connecting to github; second, installing both Rcpp and gganimate.
library(devtools)
library(RCurl)
library(httr)
set_config( config( ssl_verifypeer = 0L ) )
devtools::install_github("RcppCore/Rcpp")
devtools::install_github("dgrtwo/gganimate")
Try the following:
install.packages("gganimate")
Note: This will depend on the version of R installed and if you are downloading from the Cran site.

MacOS Rstudio devtools loading fails

I need to install the package devtools in R on my mac. The R version is 3.2.3.
It gives an error saying
Warning in install.packages :
download had nonzero exit status
Warning in install.packages :
download of package ‘curl’ failed
Other posts addressing similar issues provide solutions to Linux (with the apt-get command, etc) but doesn't seem to have a Mac solution. Highly appreciate if someone with insight can offer some guide here.
The problem pertains to the download, have a look at this discussion. You can consider downloading the package first and installing a package from a local zip file.
install.packages("local_package_file", repos = NULL)
or more specifically:
install.packages("devtools.zip", repos = NULL, type = "source")
as shown on the devtools # GitHub.
You didn't mentioned, but I understand that you have the Xcode installed as well. Alternatively, it could be informative to check if your R compiler has no problems with connecting to the Internet, you can use the code: is.character(getURL("www.google.com")).

Resources