Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
154 views
in Technique[技术] by (71.8m points)

How should I save external images for the vignettes in my R-package so that my package will pass travis-CI build check?

I am trying to set up continuous integration for my R package for the first time, using travis-CI. My package passes R CMD check with no Errors, Warnings, or Notes, but I keep getting the following error from travis: File figure1.png not found in resource path

travis-CI Error message

figure1.png (and all other images required for my vignettes) are saved in the /vignettes folder with the RMarkdown files. The vignettes build fine with devtools::install(build_vignettes = TRUE) and devtools::install_github(build_vignettes = TRUE) (worked on Windows and a Mac).

I've tried a few different things based on Wickham's R Packages, Writing R Extensions, and posts from different forums, but I always get the same error. I've tried:

  1. Putting the vignette RMarkdown and image files in a /doc folder (which seems very un-devtools-like because this folder is added to .gitignore when you run build_vignettes(). I removed from .gitignore to try this).

  2. Putting the vignette RMarkdown and image files in a inst/doc folder (same note as above).

  3. Including a .install_extras file with in the vignettes folder, with the line "*.png".

  4. Saving figure1 as a .jpg (because there is one .jpg file that is called BEFORE figure1.png, but I have not had an error about that image).

I also ran rhub::check_for_cran() and got a similar warning message for several platforms (but not Windows, which is what I am using to write the package): File figure1.png not found in resource path.

rhub warning

Can someone please clarify how I should save external images for my vignettes so that my package will pass this build check? I can provide a link to the repo if that would be helpful.

sessionInfo:

R version 4.0.2 (2020-06-22)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)
question from:https://stackoverflow.com/questions/65829287/how-should-i-save-external-images-for-the-vignettes-in-my-r-package-so-that-my-p

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

It turns out the problem was not where I was saving the images, but how I was referring to them in the RMarkdown file.

I realized the package was passing for Windows and Mac but failing for Ubuntu. Someone pointed out to me that linux is case-sensitive, so I changed all of the file extensions in the RMarkdown file from ".png" to ".PNG" and the package passed!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

Just Browsing Browsing

[3] html - How to create even cell spacing within a

1.4m articles

1.4m replys

5 comments

57.0k users

...