I have been trying to install the ggplot2 package in R and this is the warning I have been getting:
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 1040720 != reported length 1152839
2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'plyr/DESCRIPTION', probable reason 'No such file or directory'
It might be helpful to note that I am using the version 3.1.1. Could you please help me understand what went wrong and how I could resolve this?
Thank you in advance.
From the comments we discovered that somehow your repos option had been set to a bad value.
install.packages has an argument called repos that can be used to specify where to find the package that you'd like to install. If you specify a valid value, it should just work. e.g. you shouldn't get the error if you do this: install.packages("ggplot2", repos="http://cran.us.r-project.org")
If you do not provide a value, it will look at the repos option. See getOption("repos") to see what is set. In your case it was
CRAN CRANextra
"freestatistics.org/cran" "stats.ox.ac.uk/pub/RWin"
neither of which are valid URLs.
You can change the value of the repos option like this
options(repos=c(CRAN="#CRAN#",
CRANextra="http://www.stats.ox.ac.uk/pub/RWin"))
Related
I recently got a new work computer where they reinstalled RStudio on it. The RStudio version was the same as the one I had on my previous computer which worked perfectly.
On my previous computer I would install and call the packages from a local folder by simply typing this code .libPaths("C:/R/Lib"). This worked perfectly for me, but now with my new computer I get an error whenever I try to call these libraries. The error message I'm getting is:
> .libPaths("C:/R/Lib")
>
Error in rbind(info, getNamespaceInfo(env, "S3methods")) :
number of columns of matrices must match (see arg 2)
In addition: Warning messages:
1: In readLines(file, skipNul = TRUE) :
cannot open compressed file 'C:/R/Lib/abd/DESCRIPTION', probable reason 'No such file or directory'
2: In readLines(file, skipNul = TRUE) :
cannot open compressed file 'C:/R/Lib/acepack/DESCRIPTION', probable reason 'No such file or directory'
> library(kableExtra)
Error: package or namespace load failed for ‘kableExtra’ in rbind(info, getNamespaceInfo(env, "S3methods")):
number of columns of matrices must match (see arg 2)
In addition: Warning message:
package ‘kableExtra’ was built under R version 3.6.3
Any suggestions on how to solve this issue is greatly appreciatted!
When I try to install caret package in R I get the following error message:
utils:::menuInstallPkgs()
--- 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.0/doc/CRAN_mirrors.csv'
Warning: unable to access index for repository https://rweb.crmda.ku.edu/cran/src/contrib:
cannot open URL 'https://rweb.crmda.ku.edu/cran/src/contrib/PACKAGES'
Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/src/contrib:
cannot open URL 'http://www.stats.ox.ac.uk/pub/RWin/src/contrib/PACKAGES'
Error in install.packages(NULL, .libPaths()[1L], dependencies = NA, type = type) :
no packages were specified
In addition: Warning message:
In download.file(url, destfile = f, quiet = TRUE) :
InternetOpenUrl failed:
How can I solve it?
Try any of the following methods:
Edit: changed https to http
install.packages("http://cran.r-project.org/src/contrib/caret_6.0-80.tar.gz",
repos=NULL, method="libcurl")
or
library(devtools)
install_url("http://cran.r-project.org/src/contrib/caret_6.0-80.tar.gz")
I recently upgraded to R 3.5.0 (Windows 10). Following this I have been unable to install dplyr. The error message I get is:
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 17723392 != reported length 17880019
2: In unzip(zipname, exdir = dest) :
error 1 in extracting from zip file
3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")):
cannot open compressed file 'BH/DESCRIPTION', probable reason 'No such file or directory'
I have been able to install other packages and changing the mirror has not helped. I have seen others report this error on but not a consistent fix.
try
install.packages('tidyverse')
then
library(tidyverse)
Tidyverse is a package that includes dplyr and it usally has less problem to get installed.
It also contains ggplot2 so you might not need to load it anymore once you call tydyverse
Have you tried setting dependencies = TRUE, like
install.packages("foo", dependencies=TRUE)
On several occasions this has helped me install packages, that wouldn't get installed otherwise.
I'm trying to install the mentioned package, but in the middle of the process the following message shown and the installation fails.
package ‘rjson’ successfully unpacked and MD5 sums checked
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 745472 != reported length 769130
2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
3: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'DBI/DESCRIPTION', probable reason 'No such file or directory'
The solution provided here couldn't help, by the way!
You have not shown us "HOW" you tried installing pkg-twitteR but from the fact that it tried to install an additional package, I'm guessing you used dependencies=TRUE in the install.packages-command. (I pretty much always use that parameter, so i'm not criticizing that strategy.) In any case you should now (and always) edit your question to include the exact command or actions you used. You should also include details of your OS and R versions. The missing item appears to be in the "DBI"-package, so I would try:
install.packages("DBI", dependencies=TRUE)
And then retry to install. The installation process sometimes fails when dependencies of dependencies are not met.
I am trying to find a way to install sentiment package in R for performing sentiment analysis.
I searched in all d repositories but it isn't available.I am trying to manually install sentiment_0.2.tar file from local directory but i get this:
Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open the connection
In addition: Warning messages:
1: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'sentiment_0.2.tar.gz/DESCRIPTION', probable reason 'No such file or directory'
How do i resolve this problem? any valuable suggestions will be of great help.
Please try:
install.packages(file.choose(), repos = NULL, type="source")
This should allow you to select the file itself and install the package subsequently. Also, please note that the package version may not be compatible with the current R version on your machine.
Thanks!