[R-pkg-devel] Installed image not found in Debian
Jeff Newmiller
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Wed May 12 00:06:26 CEST 2021
Why aren't you using system.file()?
On May 11, 2021 1:45:37 PM PDT, Tiago Olivoto <tiagoolivoto using gmail.com> wrote:
>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() <
>https://github.com/TiagoOlivoto/pliman/blob/master/R/utils_imagem.R#L125>
>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 <
>https://win-builder.r-project.org/incoming_pretest/pliman_0.1.0_20210511_212904/Windows/00check.log>
>but an error was got in Debian <
>https://win-builder.r-project.org/incoming_pretest/pliman_0.1.0_20210511_212904/Debian/00check.log
>>
>The error occurs when image_import () has been called, for example
>
>image_import(image_pliman("soybean_touch.jpg"))
>Error: 'soybean_touch' not found in
>.//srv/hornik/tmp/CRAN/pliman.Rcheck/pliman/tmp_images
>
>It seems that this error comes from this check <
>https://github.com/TiagoOlivoto/pliman/blob/master/R/utils_imagem.R#L92-L97>
>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")
>image
>[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,
>Tiago
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-package-devel using r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-package-devel
--
Sent from my phone. Please excuse my brevity.
More information about the R-package-devel
mailing list