as_image(src, width = NULL, height = NULL, unit = "in", guess_size = TRUE, ...)
Arguments
image filename
size of the image file. It can be ignored if parameter guess_size=TRUE
, see parameter guess_size
.
unit for width and height, one of "in", "cm", "mm".
If package 'magick' is installed, this option can be used (set it to TRUE
and don't provide values for paramters width
and height
). When the flextable will be printed, the images will be read and width and height will be guessed. This should be avoid if possible as it can be an extensive task when several images.
unused argument
This chunk option requires package officedown in a R Markdown context with Word output format.
PowerPoint cannot mix images and text in a paragraph, images are removed when outputing to PowerPoint format.
See alsoOther chunk elements for paragraph: as_b()
, as_bracket()
, as_chunk()
, as_equation()
, as_highlight()
, as_i()
, as_sub()
, as_sup()
, as_word_field()
, colorize()
, gg_chunk()
, grid_chunk()
, hyperlink_text()
, linerange()
, minibar()
, plot_chunk()
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
}
#> Loading required package: magick
#> Linking to ImageMagick 6.9.12.98
#> Enabled features: fontconfig, freetype, fftw, heic, lcms, pango, raw, webp, x11
#> Disabled features: cairo, ghostscript, rsvg
Sepal.Length
Sepal.Width
Petal.Length
Petal.Width
Species
5.1
3.5
1.4
0.2
setosa
4.9
3.0
1.4
0.2
setosa
4.7
3.2
1.3
0.2
setosa
4.6
3.1
1.5
0.2
setosa
5.0
3.6
1.4
0.2
setosa
5.4
3.9
1.7
0.4
setosa
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4