Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

R - What does "incomplete block on file" mean?

Tags:

package

r

I am using RStudio, and am trying to use packrat with my current project. I click the checkbox "Use packrat with this project" and press 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 on this error, but based on this code (searching for the error string, incomplete block on file), it seems this relates to an unexpected file length/size.

I assume the download may be corrupt? But I have tried multiple times.

Or perhaps I don't have the correct permissions? But the project file should have no issues here.

Has anybody else had this issue?

like image 590
Gilly Avatar asked Aug 25 '14 07:08

Gilly


1 Answers

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.

like image 172
Yaroslav Admin Avatar answered Nov 15 '22 08:11

Yaroslav Admin