Learn R Programming

flextable (version 0.9.5)

grid_chunk: 'Grid Graphics' chunk wrapper

Description

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

  • compose() and as_paragraph(),

  • append_chunks(),

  • prepend_chunks().

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

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

Run this code
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
    )
  )
}
ft_1

Run the code above in your browser using DataLab