问题
Searching on stackoverflow questions, I found out this link: Error in file.download when downloading custom file .
However, my case is a little bit different (I think):
1) I get this annoying warning when installing some packages from CRAN (or also just some dependencies that get generally installed together with the required package).
2) The downloaded length always appear to be equal to the reported length, so there should be no warning.
As an example, I copy-paste here the warning that has just appeared in updating mgcv
.
Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
downloaded length 1886962 != reported length 1886962
The mode
argument is already set to "wb", so the solution offered in the SO link does not seem to work.
It is very strange, because I have re-installed both R and RStudio recently for other reasons, but this warning has not desappeared.
Any advise is welcome.
回答1:
For reference:
I am running Windows Vista, and am getting the same error for various package installs (where the download size is reported to not equal the reported length despite the numbers displayed being equal). The packages appear to install correctly, despite the reported error.
RStudio version 0.98.1091
> SysInfo()
release Vista x64
version build 6002, Service Pack 2
> version
platform x86_64-w64-mingw32
version.string R version 3.1.2 (2014-10-31)
My guess (without any knowledge of the internals of the install.packages
code) is that while integers are being reported, they are not being compared as integers, and so throwing the error.
回答2:
I had encountered the same problems on windows or linux server. I believed that this is probably caused by the network speed. I tried to install this package for the second or even the third time (using the function install.packages) or manually download the desired package from CRAN and then installed it and that fixed the problem.
回答3:
I solved my problem by going to this site and downloading the required package. The problem of different lengths was due to the inability to download the folder completely from R so I did download it directly and call it from the install button in Packages and selecting zip file rather than CRAN. Then just select the folder and that was for me the solution.
来源:https://stackoverflow.com/questions/27583767/warning-downloaded-length-reported-length-in-installing-packages-from-cran