Cannot open compressed file when installing R packages - r

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!

Related

R studio: error message when I was trying to intall a package

I'm very new to R studio.
Was trying to do my assignment, that need to install a package. But when I was doing so, an error message came out
Here is the whole thing including what I put in:
install.packages('Seurat')
trying URL 'cran.rstudio.com/bin/windows/contrib/4.1/Seurat_4.0.5.zip' Content type 'application/zip' length 2779717 bytes (2.7 MB) downloaded 2.7 MB package ‘Seurat’ successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\tengb\AppData\Local\Temp\RtmpSImCvj\downloaded_packages
Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]="C:/Users/tengb/OneDrive/??": The filename, directory name, or volume label syntax is incorrect
It was weird that it shows some location of Onedrive, but I was not trying to install it in onedrive at all. I also tried to set the working directory to a folder that does not have any weird characters but, this warning message still show up.

Unable to load dplyr in 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.

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.

incomplete downloading error while installing a package in R

i am trying to install lubridate package in r using following syntax
install.packages("lubridate")
but it is throwing a error by saying that it is not able to download package completely
below is the error where you can see that downloaded size is not equal to reported size
Installing package into ‘C:/Users/vikas.mittal/Documents/R/win-library/3.3’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/bin/windows/contrib/3.3/lubridate_1.6.0.zip'
Content type 'application/zip' length 654286 bytes (638 KB)
downloaded 248 KB
Warning in install.packages :
downloaded length 253952 != reported length 654286
Warning in install.packages :
error 1 in extracting from zip file
Warning in install.packages :
cannot open compressed file 'lubridate/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

install xlsx and xlsxjars in R 3.2.0

Since today I am using the R Version 3.2.0 for statistical analysis. Today I try to install the packages "xlsx" and "xlsxjars" for my new installation but it didn't work. Every time I try to install the packages (install.packages("xlsx")) I get the following error message:
Warning in install.packages :
downloaded length 9351168 != reported length 9485172
trying URL 'http://cran.rstudio.com/bin/windows/contrib/3.2/xlsx_0.5.7.zip'
Content type 'application/zip' length 400857 bytes (391 KB)
downloaded 391 KB
Warning in install.packages :
error 1 in extracting from zip file
Warning in install.packages :
cannot open compressed file 'xlsxjars/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the Connection`
The problem only take place when I try to install the xls-packages. Other packages can be installed smoothly without any problems.
I hope there is anyone out there who had already installed the aforesaid packages in R Version 3.2.0 and can give me a short advice how to install the packages in the new R Version?
First,
setInternet2(use=TRUE)
Then install necessary packages individually:
install.packages('rJava')
install.packages('xlsxjars')
install.packages('xlsx')

Resources