0

Update

Fixed it

  x <- tolower(name)
  sysloc <- system.file(package="RanglaPunjab")
  x <- paste (sysloc,"/img/",x,".jpg", sep="")
  jj <- readJPEG(x,native=TRUE)
  plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE)
  rasterImage(jj,0,0,1,1)

I created R package according to this tutorial

From what I understand, folder inst will include all the files verbatim in final package. I included directory img with all the photos that ShowPalettePhoto(name) should display

R package is located on GitHub, https://github.com/ArtieLadie/RanglaPunjab

Below is photo of System Files directory (after installing package on my machine)

img folder is in same level as R. Function ShowPalettePhoto(name) accesses the jpg with following command.

  x <- paste ("./img/",x,".jpg", sep="")
  jj <- readJPEG(x,native=TRUE)
  plot(0:1,0:1,type="n",ann=FALSE,axes=FALSE)
  rasterImage(jj,0,0,1,1)

Where am I going wrong?

Error in readJPEG(x, native = TRUE) : unable to open ./img/teej.jpg

enter image description here

Artie Ladie
  • 521
  • 4
  • 14

0 Answers0