R 带字符串数组的管道图像注释

R 带字符串数组的管道图像注释,r,for-loop,pipe,imagemagick,R,For Loop,Pipe,Imagemagick,我正在尝试使用magick中的管道操作符对带有循环的图像进行注释,以替换以下代码: Strings <- c('Some text', 'Some other text') Locations <- c("+10+10", "+30+50") image_read("https://jeroen.github.io/images/frink.png") %>% image_annotate(Strings[1],

我正在尝试使用magick中的管道操作符对带有循环的图像进行注释,以替换以下代码:

Strings <- c('Some text', 'Some other text')
Locations <- c("+10+10", "+30+50")

image_read("https://jeroen.github.io/images/frink.png") %>%
  image_annotate(Strings[1], location = Locations[1], size = 20)  %>%
  image_annotate(Strings[2], location = Locations[2], size = 20)  
这将导致
错误:“image”参数不是magick image对象。
。及

  lapply(. %>% image_annotate(Strings, location = Locations, size = 20)) 
这将在magick_image_注释(图像、文本、重力、位置、度数)中给出错误
错误:需要单个字符串值:[type=character;extent=2]。

正确的写作方法是什么

  lapply(. %>% image_annotate(Strings, location = Locations, size = 20))