2

I created an R package on Windows 10 machine using RStudio Version 1.1.453

The package can be found on GitHub

When I ran check(), there were zero errors, warning, notes.

After submitting to CRAN, I received error for Debian,

> ShowPalettePhoto("GoldenTemple")
Error in readJPEG(x, native = TRUE) : 
  unable to open /srv/hornik/tmp/CRAN/RanglaPunjab.Rcheck/RanglaPunjab/img/goldentemple.jpg
Calls: ShowPalettePhoto -> readJPEG

Below is how I implemented function to show a photo.

How do I implement so it can be viewed in Debian (or any OS)?

Please point me in the right direction.

ShowPalettePhoto <- function(name){

  pal <- RanglaPunjab(name)
  if (is.null(pal))
    stop("palette not found.")
  x <- tolower(name)
  sysloc <- system.file(package="RanglaPunjab")
  x <- paste (sysloc,"/img/",x,".jpg", sep="")
  jj <- readJPEG(x,native=TRUE)
  graphics::plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE)
  graphics::rasterImage(jj,0,0,1,1)
}
3
  • Linux file systems are case sensitive, while windows not. Most likely your image file has some uppercase letters in it. Commented May 25, 2018 at 19:42
  • @RalfStubner That's what I'm thinking. Changing extension to lowercase ...... Commented May 25, 2018 at 19:46
  • Yes, I think that did the trick! Commented May 25, 2018 at 23:12

1 Answer 1

3

The problem. i.e.

  unable to open /srv/hornik/tmp/CRAN/RanglaPunjab.Rcheck/RanglaPunjab/img/goldentemple.jpg

is that you've hard coded a reference to a file that doesn't exist on the remote machine. It only exists on your local computer.

So, you need to take any one of several simple ways to solve this, such as linking to the photo via the Internet or making sure to include the Golden Temple photo in your package with an appropriate path that can be reached by anyone who installs it.

I just had a glance at your GitHub. You've got photos in an img folder but it's probably the first part of the path that's not being appropriately updated for other users (/srv/hornik/tmp/CRAN/RanglaPunjab.Rcheck/RanglaPunjab). Or, as you and another user discussed in the comments, perhaps you have the case wrong.

1
  • 1
    Thanks for your quick reply. Certainly helpful to consider for future packages/releases. Just now I submitted to CRAN - they are doing manual inspection ::fingers-crossed:: Commented May 25, 2018 at 23:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.