ropensci / magick

Magic, madness, heaven, sin
https://docs.ropensci.org/magick
Other
462 stars 65 forks source link

R: Get function with magick image #356

Open Pablo-Erazo opened 2 years ago

Pablo-Erazo commented 2 years ago

I've been trying to develop an R code that allows to extract the different parts of an agarose gel corresponding to different samples. For this I've tried to dynamically export the differente cropped images using loop (for) function in this way:

for (i in 1:length(get("project"))) { imagewrite(get( "gel",project[i] ), paste0("gel_", project[i] ,".jpg"),format = "jpg") } where variable:

Running this line independently works fine. However, I've been trying to create a function to run the code in one line. When I run the complete function (which includes the line I've shown), this error ocurrs.

image

It seems that the function "image_write" doesn't work when I try to dinamically export the images, by generating the variables with the get function. Is there a way to overcome this issue?