Error/warning while installing any package in R [duplicate] - r

I am trying to download the zoo package to work with time series using:
install.packages("zoo")
but I get the following message:
--- Please select a CRAN mirror for use in this session ---
Warning: unable to access index for repository http://cran.cnr.Berkeley.edu/bin/windows/contrib/2.12
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.12
Warning messages:
1: In open.connection(con, "r") :
unable to connect to 'cran.r-project.org' on port 80.
2: In getDependencies(pkgs, dependencies, available, lib) :
package ‘zoo’ is not available
I tried several different mirrors and I keep getting the same error... Is zoo just not available in most mirrors or is something going wrong?

Please see FAQ 2.19. Or, alternatively, a quick search for "unable to connect to 'cran.r-project.org' on port 80" on rseek.org.
Reading the FAQ and doing a search for the error will usually help you resolve most issues.

Related

Error while checking the R package created

I was running the check for my package that I have created when I got this error due to some example file that has been created outside my package directory which has been created due to the vignette I have created because while checking when R was reading the vignette, it got this error and I tried to delete the folder that has been created outside my package directory but I am not able to. Here is the error that is shown while checking the package:
E checking examples ... Running examples in 'ikpack-Ex.R' failed
Warning in file(con, "r") :
cannot open file 'ikpack-Ex.Rout': Permission denied Error in file(con, "r") : cannot open the connection Execution halted
Any kind of help related to this is appreciated.

R failed to find 'stats' and 'utils' packages in M1 mac

When trying to open R (I tried to install and reinstall all available versions of aarn64 for the M1 chip) I get the following error message:
During startup - Warning messages:
1: package ‘utils’ in options("defaultPackages") was not found
2: package ‘stats’ in options("defaultPackages") was not found
tried to look for the .libPaths() and I can see the packages in the library.
Thanks for the help!
Perhaps your path in .zprofile is being altered? I had this issue today, with a non-system Python install modifying .zprofile. I commented out the PATH in .zprofile, sourced it, and then re-ran R without the errors.

Permission denied error installing rpart.plot package in R

Hello when I try to install rpart.plot package in R I receive the following error
Error in install.packages : cannot open file 'C:/Users/hp/Documents/R/win-library/4.0/file220c4f062ad7/Formula/doc/Formula.pdf': Permission denied
Perhaps a dependency problem. The rpart.plot package depends on pkg:'earth' and it in turn depends on pkg:Formula. Unfortunately, the install.packages function doesn't construct a search path for this situation and simply reports an error if the second-level dependency is not present. So do this:
install.packages("Formula", dependencies=TRUE)
Install.packages("rpart.plot", dependencies=TRUE)

How can I install readxl package for R?

I am trying to install readxl package for R.
The following is the RStudio output:
To learn more and/or disable this warning message see the "Use secure download method for HTTP" option in Tools -> Global Options -> Packages.
> library('readxl')
Error in library("readxl") : there is no package called ‘readxl’
> install.packages("readxl")
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Installing package into ‘C:/Users/Lenovo/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/src/contrib:
cannot open URL 'http://cran.rstudio.com/src/contrib/PACKAGES'
Warning in install.packages :
package ‘readxl’ is not available (for R version 3.5.0)
Warning in install.packages :
unable to access index for repository http://cran.rstudio.com/bin/windows/contrib/3.5:
cannot open URL 'http://cran.rstudio.com/bin/windows/contrib/3.5/PACKAGES'
>
The following is the R's console output:
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
> install.packages("readxl")
Installing package into ‘C:/Users/Lenovo/Documents/R/win-library/3.5’
(as ‘lib’ is unspecified)
--- 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'); using local file 'C:/PROGRA~1/R/R-35~1.0/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://cloud.r-project.org/src/contrib:
cannot open URL 'https://cloud.r-project.org/src/contrib/PACKAGES'
Warning: unable to access index for repository https://cloud.r-project.org/bin/windows/contrib/3.5:
cannot open URL 'https://cloud.r-project.org/bin/windows/contrib/3.5/PACKAGES'
Warning messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed: ''
2: package ‘readxl’ is not available (for R version 3.5.0)
>
How can I solve this issue?
The error messages definitely seem to be telling you, that R cannot connect to download the packages. Here are some thoughts:
Does your user profile have administrative privileges? I am not a huge Windows user, but your are technically trying to add software, which sometimes requires escalated privileges. Maybe trying running R as Admin in windows, for this one issue to see if that is the problem. (Doesn't seem very likely.)
If it is a firewall issue you could try to add an exception to your firewall settings for R and/or Cran repositories.
Have your tried to account for dependent packages? install.packages("readxl", dependencies = TRUE) (This can cause its own bag of issues as well, so consider yourself forewarned.)
Can you download any other packages? As you can access the internet to make stack posts, are asking a fairly entry level question, and the URL's are valid so there may be a configuration issue with your installation of R. If all else fails, you may wish to uninstall/reinstall R on your system (and Maybe R studio while you are at it) as that may help to repair something if it is damaged. Use the file checksums, the are there for a reason.

Failed to download mirror file in R programing language (version 3.5)

I facing problem to install any package in R programing language.
install.packages("nnet")
after hitting enter to run the above code, getting the following:
Installing package into ‘C:/Users/Acer/Documents/R/win-library/3.4’
(as ‘lib’ is unspecified)
--- 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'); using local file 'C:/PROGRA~1/R/R-34~1.2/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository
https://ftp.iitm.ac.in/cran/src/contrib: cannot open URL
'https://ftp.iitm.ac.in/cran/src/contrib/PACKAGES' Warning: unable to
access index for repository
https://ftp.iitm.ac.in/cran/bin/windows/contrib/3.4: cannot open URL
'https://ftp.iitm.ac.in/cran/bin/windows/contrib/3.4/PACKAGES' Warning
messages:
1: In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed: 'The connection with the server was reset'
2: package ‘nnet’ is not available (for R version 3.4.2)
I am not able to fix the problem. Can anyone help me on this issue, please?

Resources