r – Error in running the example code of as_image
I am trying to run the example code in R( R studio version: 2023.06.1+524; R version: 4.2.1; flextable version: 0.9.2):
img.file <- file.path( R.home("doc"),
"html", "logo.jpg" )
if (require("magick")) {
myft <- flextable( head(iris))
myft <- compose( myft, i = 1:3, j = 1,
value = as_paragraph(
as_image(src = img.file),
" ",
as_chunk(Sepal.Length,
props = fp_text_default(color = "red"))
),
part = "body")
ft <- autofit(myft)
ft
}
And then i meet an error:
Error in as_chunk(Sepal.Length, props = fp_text_default(color = "red")) :
object 'Sepal.Length' not found
So are there something wrong? What should I do?
Thank you!
Read more here: Source link
