append chunks (for example chunk as_chunk()) in a flextable.

append_chunks(x, ..., i = NULL, j = NULL, part = "body")

Arguments

x

a flextable object

...

chunks to be appened, see as_chunk(), gg_chunk() and other chunk elements for paragraph.

i

rows selection

j

column selection

part

partname of the table (one of 'body', 'header', 'footer')

Illustrations

See also

as_chunk(), as_sup(), as_sub(), colorize()

Other functions for mixed content paragraphs: as_paragraph(), compose(), prepend_chunks()

Examples

library(flextable)
img.file <- file.path(R.home("doc"), "html", "logo.jpg")

ft_1 <- flextable(head(cars))

ft_1 <- append_chunks(ft_1,
  # where to append
  i = c(1, 3, 5),
  j = 1,
  # what to append
  as_chunk(" "),
  as_image(src = img.file, width = .20, height = .15)
)
ft_1 <- set_table_properties(ft_1, layout = "autofit")
ft_1
#> a flextable object.
#> col_keys: `speed`, `dist` 
#> header has 1 row(s) 
#> body has 6 row(s) 
#> original dataset sample: 
#>   speed dist
#> 1     4    2
#> 2     4   10
#> 3     7    4
#> 4     7   22
#> 5     8   16