Unable to load dplyr in R - r

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.

Related

Errors Installing and Calling R Packages

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!

Can't install twitteR package in R

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.

Cannot open compressed file when installing R packages

This problem recently came up when I try to install new packages in R 3.2.0. I noticed it when trying to install vegan, but I seem to get the same message for all packages I try to install, including when I try to install manually from a downloaded tar.gz. The entire message I get when I try to install any package is:
utils:::menuInstallPkgs()
also installing the dependency ‘permute’
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.2/permute_0.8-4.zip'
Content type 'application/zip' length 501108 bytes (489 KB)
downloaded 489 KB
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.2/vegan_2.3-0.zip'
Content type 'application/zip' length 2863206 bytes (2.7 MB)
downloaded 2.7 MB
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) :
write error in extracting from zip file
2: In read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :
cannot open compressed file 'permute/DESCRIPTION', probable reason 'No such file or directory'
After looking at previous questions, I tried:
install.packages("vegan", repos="http://cran.us.r-project.org")
but still get the same error. I also tried to reset the repos with:
options(repos=c(CRAN="#CRAN#",
CRANextra="http://www.stats.ox.ac.uk/pub/RWin")
But still get the same error, for any package I try to install.
Thanks for any help.
I got the same error when there was no space left on my computer. I cleared some space and it worked!

sentiment package installation from local zip file issue

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!

Warning while installing package in R

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"))

Resources