Files in Collate field missing from package when installing from Github - r

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.

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.

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.

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.

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.

Related

"Unable to Load XML.dll" when Building CRAN XML v3.98-1.10

Trying to compile version 3.98-1.10 of R's XML package. I grabbed the 64bit 7zip files from here: https://www.zlatkovic.com/pub/libxml/64bit/
I unzipped the file, and then placed the contents of the unzipped folder's \bin, \include, and \lib into C:\rtools40\mingw64\(bin | include | lib) accordingly. I then ran install_version("XML", version = "3.98-1.10", repos = "http://cran.us.r-project.org") in Rstudio.
It successfully makes it past the make phase to "byte-compile and lazy loading". A LOCK folder is made with all files intact, yet it errors out looking for the XML.dll in the lock:
error: unable to load shared object 'C:/Users/myuser/Documents/R/win-library/4.0/00LOCK-XML/00new/XML/libs/x64/XML.dll'
I opened the LOCK folder during a second attempt to see if the dll was truly missing, but it actually shows up - it seems to spontaneously disappear when it's needed (edit - the contents of the entire folder disappear):
My current version of XML isn't missing its dll either. Anyone encounter this issue and solve it?
Pastebin of terminal output (minus make stage) here: https://pastebin.com/ZayU5XNX
EDIT:
Found out RStudio can conveniently install tar.gz files, so I downloaded the archived version from CRAN. Running install.packages(file.choose(), repos=NULL) opens a navigation panel and you can select the tar.gz file wherever it was saved to. The make dialogue seems to be more verbose, but it still made it to the lazy-load step. Still the exact same error as my previous attempt.
I solved this by just using xml2 instead since it appears XML is orphaned.

Submitting a package to CRAN: .tar.gz file

I have a package I am ready to submit to CRAN (everything checks out). However, in the spot where it says Choose File, I am unsure what file to choose, as it says it requires a .tar.gz file, which I gather is some kind of compressed file?
Do I need to compress everything into a .tar.gz file? If so, how?
If not, I have a .Rproj file, and various files like namespace and description and license, so it is unclear to me which file to submit.
I apologize if this is a simple question, this is my first package to be submitted.
You have two options here. Use R's command line command:
> R CMD build /path/to/package/directory
Or use devtools::build from within R:
R> devtools::build( "path/to/package/directory" )
Both result in a tar.gz file on your local file system. The name will look like: mypackage_[Version].tar.gz
It is this file that you load to CRAN.

RStudio: Error on testing documentation with?

I'm using latest RStudio 0.99.879. I'm creating a new project as R Package.
After running (as mentioned on http://r-pkgs.had.co.nz/man.html)
devtools::document()
?.
I get an error
/path/to/my/package/man: Sections \title, and \name must exist and be unique in Rd files
What's the reason and how can I avoid it?
Edit: I've deleted manually the file man/hello.Rd so roxygen2 can generate it.
Hadley told me "." is the end of the sentence. So there's no magic.

Package development : location of pdf manual and vignette

When building mypackage, everything seems to work:
library(devtools)
build(vignettes = T, manual = T)
* checking for file ‘/storage/Documents/client/validate/mypackage/DESCRIPTION’ ... OK
* preparing ‘mypackage’:
* checking DESCRIPTION meta-information ... OK
* installing the package to build vignettes
* creating vignettes ... OK
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building ‘mypackage_0.1.tar.gz’
[1] "/storage/Documents/client/validate/mypackage_0.1.tar.gz"
However I can't find neither the PDF manual nor the vignette.
Vignette: followed workflow as described here, using RStudio / devtools / markdown. However:
vignette("mypackage")
Warning message:
vignette ‘mypackage’ not found
For the PDF manual I have tried this, but no success.
So, my question is: where can I find the PDF manual and the vignette?
I can find my PACKAGE-manual.pdf, where throughout PACKAGE is my package name, by first going to
C:\Users\USERNAME\AppData\Local\Temp\
within the Windows folder directory. You may have to enable hidden folders and files to see this. Within this folder are many many temp folders and other such things. Sort by date, and scroll down to where the folders are. The most recent one is the one you probably want; the ones that prefix with a "Rtmp" are the ones created by R.
Within the (probably) most recent Rtemp[blah] should be a folder entitled PACKAGE.Rcheck. In that PACKAGE.Rcheck folder should be the manual pdf PACKAGE-manual.pdf, assuming it was successfully created.
The full path string on my computer (for this package-creation run) is
C:\Users\USERNAME\AppData\Local\Temp\RtmpG0713j\PACKAGE.Rcheck\PACKAGE-manual.pdf.
You might have to search through a couple of Rtmp[blah] folders before you get the right one.
Not sure quite where RStudio puts it, but in a bare bones check operation the pdf version of the manual should be in a folder called mypackage.Rcheck If you created a mypackage-package.R file then when the package is installed, ?mypackage should lead you to the html version of the manual. The vignette you can get by installing your package and doing vignette("mypackage").
I don't know for the manual, but if you build from rstudio using the 'build and reload' button (nearby the check buttonl, the vignettes, if properly built, should end up in 'yourpackage' subfolder of your r library folder, i think in inst/doc sub sub folder.
Also, for vignettes did you try building them using devtools::build_vignettes ? Usually works for me.

creating package

i am creating a package in R language, everything is running properly, but when i run R CMD check , it shows an error message while running examples.. i.e.
"can't open the file." "No such file or directory"
actually my function needs a PubMed text file containing abstracts from the PubMed, i have placed my text file in every sub-directory of my package, but its not working. showing same error again and again.
so please suggest me the right way how to put a text file in a package which can be used by examples to run properly.
i will be very thankful to you.
Usually you put such data in the /inst folder. E.g.:
<packageRoot>/inst/pubmed/myfile
After the package is build you can access the content of this folder from within the package like this:
system.file( "pubmed/myfile", package="<package>" )
See for more information http://cran.r-project.org/doc/manuals/r-release/R-exts.pdf (1.1.5 Data in packages).
I suggest you to use devtools and roxygen2 packages. Basically, you just need to prepare description and .R files.
see more details in this brilliant answer :devtools roxygen package creation and rd documentation

Resources