R - What does “incomplete block in file” mean?

I am using RStudio and trying to use packrat with my current project. I check the box "Use packrat with this project" and click OK, where I get the following output from the console:

> packrat::init() Initializing packrat project in directory: - "/Users/Ash/Dropbox/Uni/2014/Thesis/Code/R" Adding these packages to packrat: _ packrat 0.4.0.12 Fetching sources for packrat (0.4.0.12) ... Error in snapshotSources(project, activeRepos(project), allRecordsFlat) : Errors occurred when fetching source files: Error in untar2(tarfile, files, list, exdir, restore_times) : incomplete block on file 

I can’t find much of this error, but based on this code (search for error string, incomplete block in file), it seems this refers to unexpected file length / size.

I assume the download might be corrupted? But I tried several times.

Or maybe I don't have the correct permissions? But the project file should not contain any problems.

Has anyone else had this problem?

+7
r package
source share
1 answer

I assume the download might be corrupted? But I tried several times.

Yes. Downloading may result in damage, or according to this thread in the R help mailing list, the problem may be caused by a damaged package on the server itself. In the latter case, it can be solved by choosing another mirror to download the package.

NOTE I will describe a solution that uses the R console instead of the Rstudio GUI because I used the packages in this way. Perhaps the described approach can work with package installations from the graphical interface.

When you install the package from the R console by doing:

 > install.packages("<package_name>") 

You are offered a list of available mirrors to choose from:

  1: 0-Cloud [https] 2: Austria [https] 3: Chile [https] 4: China (Beijing 4) [https] ... 

Just choose another one (preferably near your location to have a faster download).


If you are not given this choice, but the download starts immediately, you have a default mirror configured (for example, Rstudio automatically sets https://cran.rstudio.com/ as the default value). You can check the selected mirror by issuing:

 > getOption("repos")["CRAN"] CRAN "https://cran.rstudio.com/" 

In the reset mirror, you can use the following commands:

 > r <- getOption("repos") > r["CRAN"] <- "@ CRAN@ " > options(repos=r) 

Now, when you try to install a new package, you can choose another mirror, as described above.

+3
source share

All Articles