Learn R Programming

crosstable (version 0.3.2)

body_add_title: Add a title to an officer document

Description

Add a title to an officer document

Usage

body_add_title(
  doc,
  value,
  level = 1,
  squish = TRUE,
  style = getOption("crosstable_style_heading", "heading")
)

Arguments

doc

the doc object (created with the read_docx function of officer package)

value

a character string

level

the level of the title. See styles_info(doc) to know the possibilities.

squish

Whether to squish the result (remove trailing and repeated spaces). Default to TRUE.

style

the name of the title style. See styles_info(doc) to know the possibilities.

Value

The docx object doc

Examples

Run this code
# NOT RUN {
library(officer)
library(crosstable)
library(dplyr)
doc = read_docx() %>% 
   body_add_title("La table iris (nrow={nrow(iris)})", 1) %>% 
   body_add_title("Description", 2) %>% 
   body_add_normal("La table iris a ", ncol(iris), " colonnes.")
#write_and_open(doc)
# }

Run the code above in your browser using DataLab