0

Before you mark this as duplicate, I wish to say that I already referred the related post 1,post 2, 3, 4

I am trying to install the dplyr and stringr package but i get the below error

Warning in install.packages :
  downloaded length 139264 != reported length 3227450
Warning in install.packages :
  error 1 in extracting from zip file
Warning in install.packages :
  cannot open compressed file 'dplyr/DESCRIPTION', probable reason 'No such file or directory'
Error in install.packages : cannot open the connection

I tried different installation commands like

install.packages(“dplyr”)
install.packages(“dplyr”,  repos="http://cran.us.r-project.org")
install.packages(“dplyr”,  repos="http://cran.us.r-project.org",type="win.binary")

> Sys.info()
       sysname        release        version         machine 
     "Windows"       "10 x64"  "build 17134"        "x86-64" 
> version
               _                           
platform       x86_64-w64-mingw32          
arch           x86_64                      
os             mingw32                     
system         x86_64, mingw32             
status                                     
major          3                           
minor          6.2                         
year           2019                        
month          12                          
day            12                          
svn rev        77560                       
language       R                           
version.string R version 3.6.2 (2019-12-12)
nickname       Dark and Stormy Night 

Till yesterday, I was able to install this package successfully. But today it is throwing this error.

This error happens with other packages like stringr as well. I tried chaging CRAN mirrors as well but still no help

Can help please?

alistaire
  • 42,459
  • 4
  • 77
  • 117
The Great
  • 7,215
  • 7
  • 40
  • 128
  • Have you tried downloading the package source files instead? [dplyr_0.8.5.tar.gz](https://cran.r-project.org/web/packages/dplyr/index.html ) – SidharthMacherla Apr 14 '20 at 08:43
  • Are you asking me to download this zip file and load them in my workspace as a local package? – The Great Apr 14 '20 at 08:46
  • But isn't there a way to fix this issue? Meaning by using install.packages()? – The Great Apr 14 '20 at 08:57
  • This is likely caused by something outside of R: your virus checker may be interfering with the download, for example. @SidharthMacherla's suggestion may let you work around that. – user2554330 Apr 14 '20 at 10:01
  • @user2554330 - But it was working fine yesterday. – The Great Apr 14 '20 at 10:09
  • But the same works in R Gui. Meaning install.packages work in R Gui. But when I use them in RStudio, I get this error. Is it possible that I install packages using R gui and load the libraries in RStudio. Will this setup work? – The Great Apr 14 '20 at 10:11
  • Try this [solution](https://stackoverflow.com/a/69706249/4502415). It worked out for me. – Mohamed Ismaiel Ahmed Oct 27 '21 at 09:12
  • Are you running code with smart quotes around `dplyr`? – Hugh Oct 27 '21 at 09:16

2 Answers2

0

I have downloaded a R package and installed from local files. Next I tried to install a package, with many imports, through Install package(s), I could not install. I closed R and restarted R, now I am able to install packages, with many imports. Rahul, R user.

Rahul
  • 1
0

This error typically happens because R cannot access the default directory for installing the packages. This error is a system-related error. Try this solution. It worked out for me. I changed the default installation directory in the environment variables and it worked smoothly.