0

Does anyone have any experience with the magick package and running ifelse/if_else statements?

Essentially I have a column which where an observation is either "yes" or "no".

If "yes" I want to overlay a "tick" image and if "no", I want to overlay a "cross" image.

This is my code

image_composite(poster, if_else(df$col1 == "yes", tick, cross), offset = "+100+200"

the "poster" is the image that I have imported into R and so is "tick" and "cross". The offset just refers to the location of the "tick" or "cross" overlaid onto "poster".

a normal example without trying to use if_else is as follows:

image_composite(poster, tick, offset = "100+200")

In the above code, poster and tick are images imported into R

Any help would be greatly appreciated

Phil
  • 5,491
  • 3
  • 26
  • 61
ts22
  • 7
  • 1
  • It would be easier to help if you create a small reproducible example along with expected output. Read about how to give a [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). – MrSmithGoesToWashington Oct 25 '21 at 12:38

0 Answers0