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)
}
Hack-R
  • 22,422
  • 14
  • 75
  • 131
Artie Ladie
  • 521
  • 4
  • 14

1 Answers1

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.

Hack-R
  • 22,422
  • 14
  • 75
  • 131
  • 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:: – Artie Ladie May 25 '18 at 23:11