Skip to contents

This function is used to insert grid objects into flextable with functions:

Usage

grid_chunk(value, width = 1, height = 0.2, unit = "in", res = 300)

Arguments

value

grid objects, stored in a list column; or a list of grid objects.

width, height

size of the resulting png file

unit

unit for width and height, one of "in", "cm", "mm".

res

resolution of the png image in ppi

Note

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 also

Other chunk elements for paragraph: as_b(), as_bracket(), as_chunk(), as_equation(), as_highlight(), as_i(), as_image(), as_sub(), as_sup(), as_word_field(), colorize(), gg_chunk(), hyperlink_text(), linerange(), lollipop(), minibar(), plot_chunk()

Examples

library(flextable)
ft_1 <- flextable(head(cars))
if (require("grid")) {
  ft_1 <- prepend_chunks(
    x = ft_1, i = 2, j = 2,
    grid_chunk(
      list(
        circleGrob(gp = gpar(
          fill = "#ec11c2",
          col = "transparent"
        ))
      ),
      width = .15, height = .15
    )
  )
}
#> Loading required package: grid
ft_1

speed

dist

4

2

4

10

7

4

7

22

8

16

9

10