body_add_table

0th

Percentile

add table

add a table into an rdocx object

Usage
body_add_table(
  x,
  value,
  style = NULL,
  pos = "after",
  header = TRUE,
  alignment = NULL,
  stylenames = table_stylenames(),
  first_row = TRUE,
  first_column = FALSE,
  last_row = FALSE,
  last_column = FALSE,
  no_hband = FALSE,
  no_vband = TRUE
)
Arguments
x

a docx device

value

a data.frame to add as a table

style

table style

pos

where to add the new element relative to the cursor, one of after", "before", "on".

header

display header if TRUE

alignment

columns alignement, argument length must match with columns length, values must be "l" (left), "r" (right) or "c" (center).

stylenames

columns styles defined by table_stylenames()

first_row

Specifies that the first column conditional formatting should be applied. Details for this and other conditional formatting options can be found at http://officeopenxml.com/WPtblLook.php.

first_column

Specifies that the first column conditional formatting should be applied.

last_row

Specifies that the first column conditional formatting should be applied.

last_column

Specifies that the first column conditional formatting should be applied.

no_hband

Specifies that the first column conditional formatting should be applied.

no_vband

Specifies that the first column conditional formatting should be applied.

See Also

Other functions for adding content: body_add_blocks(), body_add_break(), body_add_docx(), body_add_fpar(), body_add_gg(), body_add_img(), body_add_par(), body_add_toc()

Aliases
  • body_add_table
Examples
# NOT RUN {
library(magrittr)

doc <- read_docx() %>%
  body_add_table(iris, style = "table_template")

print(doc, target = tempfile(fileext = ".docx") )
# }
Documentation reproduced from package officer, version 0.3.14, License: GPL-3

Community examples

Looks like there are no examples yet.