R - What does "incomplete block on file" mean?
I assume the download may be corrupt? But I have tried multiple times.
Yes. The download may corrupt or according to this thread in the R help mailing list the issue might be caused by corrupted package on the server itself. In latter case it can be solved by selecting different mirror for downloading package.
NOTE I'll describe a solution, which uses R console instead of Rstudio GUI, because I used to install packages this way. Described approach can probably work with package installs from GUI as well.
When you install package from R console by executing:
> install.packages("<package_name>")
You are presented with the list of available mirrors to choose from:
1: 0-Cloud [https] 2: Austria [https]
3: Chile [https] 4: China (Beijing 4) [https]
...
Just select another one (preferably one close to your location to have faster download).
If you're not presented with such choice, but download starts right away, you have a default mirror configured (for example Rstudio automatically sets https://cran.rstudio.com/
as a default). You can check your selected mirror by issuing:
> getOption("repos")["CRAN"]
CRAN
"https://cran.rstudio.com/"
To reset default mirror you can use following commands:
> r <- getOption("repos")
> r["CRAN"] <- "@CRAN@"
> options(repos=r)
Now, when you try to install new package you can choose another mirror as described above.
Answering a million years later... But if anyone gets here as I did while looking for Error in untar2(tarfile, files, list, exdir, restore_times) : incomplete block on file
, your problem may be related to the presence of private packages in your code.
Follow this thread. The last comment saved my life.
You need to build tar.gz of your custom private packages and save it a unique folder. From there just run this code:
packrat::set_opts(local.repos = "path/to/the/folder/with/your/tar.gz/files")
packrat::install_local('yourpackage')
After that, run again packarat::init()
and it's gonna be a happy day again.