[R-pkg-devel] Installed image not found in Debian

Tiago Olivoto t|@goo||voto @end|ng |rom gm@||@com
Tue May 11 22:45:37 CEST 2021

Dear all,
I just submitted a new package 'pliman' (
https://github.com/TiagoOlivoto/pliman) and it does not pass the incoming
checks automatically.
I have some images that are under '/inst/tmp_images' to be installed with
the package. In some examples and Vignettes, I use the helper function
image_pliman() <
to get the patch of a given image

Then, I use image_import() <
https://github.com/TiagoOlivoto/pliman/blob/master/R/utils_imagem.R#L69> to
import the image into R.

All tests passed in Windows <
but an error was got in Debian <
The error occurs when image_import () has been called, for example

Error:  'soybean_touch' not found in

It seems that this error comes from this check <
that checks if the image name is available in the directory. Please, see a
toy example with my data.

# Get the patch of the image
image <- image_pliman("soybean_touch.jpg")
[1] "E:/Documents/R/win-library/4.0/pliman/tmp_images/soybean_touch.jpg"

# Get the directory of the image
img_dir <- file_dir(image)
> img_dir
[1] "E:/Documents/R/win-library/4.0/pliman/tmp_images"

# Get all files in the directory
> all_files <- sapply(list.files(img_dir), file_name)
> all_files
    background.jpg        la_back.jpg        la_leaf.jpg      la_leaves.JPG
      "background"          "la_back"          "la_leaf"        "la_leaves"
    la_pattern.JPG        la_temp.jpg objects_300dpi.jpg       sev_back.jpg
      "la_pattern"          "la_temp"   "objects_300dpi"         "sev_back"
   sev_healthy.jpg       sev_leaf.jpg    sev_leaf_nb.jpg      sev_sympt.jpg
     "sev_healthy"         "sev_leaf"      "sev_leaf_nb"        "sev_sympt"
     soy_green.jpg  soybean_grain.jpg  soybean_touch.jpg
       "soy_green"    "soybean_grain"    "soybean_touch"

# Get the name of the image and check if it is in the directory
> img_name <- file_name(image)
> img_name
[1] "soybean_touch"

if(!grepl("http", img_dir, fixed = TRUE) & !img_name %in% all_files){
  stop(" '", img_name, "' not found in ", img_dir,  call. = FALSE)

In this case, there is no error since  "soybean_touch" is in 'all_files'

I have no idea how to fix this issue and why this error occurs only on
Debian and not on Windows. Any suggestion to fix the error and/or improve
the code will be welcome!
Thanks in advance,

	[[alternative HTML version deleted]]

More information about the R-package-devel mailing list