Files in Collate field missing from package when installing from Github
Asked Answered
S

5

7

Note: I cross-posted this question here: https://github.com/hadley/devtools/issues/245

Update: @hadley just closed the issue since he can install now. I have tested it just now and install_github works on Windows too. Apparently I need wait for some time for Github archive to include the new committed changes. For people encounter the same problem, @hadley pointed out that I have .R and .r files in R/ and all the files in DESCRIPTION collate have .r extensions.

I am writing an R package and put it on Github. I can build and load on my own computer. However, after running install_github("KineticEval",username="zhenglei-gao"), I got the following error:

* installing *source* package 'KineticEval' ...
** R
Error in .install_package_code_files(".", instdir) : 
files in 'Collate' field missing from 'C:/Users/z.gao/AppData/Local/Temp/RtmpUzWWYn    /R.INSTALLd3c17515a0/KineticEval/R':
  kingraph.r
  kinplot.r
  FOCUS2006A.r
  FOCUS2006B.r
  FOCUS2006C.r
  FOCUS2006D.r
  modFit1.r
  IRLSkinfit.full.r
  mkinfit.full.r
ERROR: unable to collate and parse R files for package 'KineticEval'
* removing 'C:/Users/z.gao/R-dev/KineticEval'

A related question is here: Files in Collate field missing from package after build from incorrect .Rbuildignore file

But I can't figure out whether the error is also related to my .Rbuildignore file.

Seward answered 6/2, 2013 at 11:48 Comment(8)
Are you using rstudio and roxygen2?Yann
@wush978, yes, I use roxygen2 to generate the Collate field.Seward
Then you should check if roxygenize is executed before R CMD INSTALLYann
@wush978, I don't know how to check that. I have locally run roxygenize and push it to Github, then try to use install_github() which automatically runs R CMD INSTALL. I can run R CMD INSTALL and install() without using the Github repository but my own repository.Seward
I suggest you to check your repository as follow. Run git clone a clean repository first. Run roxygenize on the cloned repository. Run git status to check if any files are modified.Yann
It installs fine for me. I'm on Linux though. And Hadley runs a Mac I believe so this might be a Windows only issue at the moment.Lateen
@wush978, I will do that when I have access to my other computer.Seward
@Dason, good to know that. I will test again on my computer and update.Seward
S
5

For people encounter the same problem, Hadley(from Github) pointed out that I have .R and .r files in R/ and all the files in DESCRIPTION collate have .r extensions. I use roxygenize to generate the collate field in DESCRIPTION.

What I did is deleting all files in R/ in the local repository and copy back, push it to Github. Only renaming .R as .r under Windows does not change the remote repository. Then the error occured again afterwards so I asked here to see if there is something more I should fix. But after a day, the error disappeared.

Seward answered 6/2, 2013 at 21:51 Comment(2)
So what did you do to fix the problem?Lateen
@Dason, I just deleted all files in R/ in the local repository and copy back. Only renaming them as .r does not change the remote repository .R as .r. Then the error occured again. After a day, the error disappeared.Seward
M
0

I had the exact same problem. I had a silly mistake in my .Rbuildignore. The file I was missing was named something like OutputPlotGenerator.R, and my .Rbuildignore file included the line output, thus removing / ignoring my R file.

Modestamodeste answered 5/12, 2017 at 11:8 Comment(0)
B
0

For some reason I had the same name twice in my description. One with a .r extension, one with .R as an extension. Removing the wrong one solved the issue.

Bluegreen answered 29/10, 2018 at 8:43 Comment(0)
D
0

For me, I had a new .R file which I had not added to the collate field in the DESCRIPTION file.

Simply adding it to that field solved the problem.

Hadley talks about it in a few places here.

Disfeature answered 8/2, 2020 at 5:47 Comment(0)
A
0

Ran into the same problem:

Error in .install_package_code_files(".", instdir) : 
files in 'Collate' field missing from 'C:/Users/hyche/AppData/Local/Temp/RtmpsxI2G7/R.INSTALLadc4a3f4024/SPORM/R':

  SPORM-package.R

  pmlkh.R

  pwlkh.R

  splkh.R

ERROR: unable to collate and parse R files for package 'SPORM'

It seemed the files in /R could not be found when installing the package from the github repository.

Solution

I moved files in /R to a place outside the package directory in the github desktop, and then pushed the github desktop (without /R) to the github repository. It cleaned /R in the github repository. I then moved files in /R back to the github desktop package. Pushed the package in the github desktop to the github repository again to update /R. Now the problem is gone.

Anguilliform answered 27/8, 2023 at 1:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.