Learn R Programming

r2rtf (version 0.1.1)

rtf_body: add table body attributes to the table

Description

add table body attributes to the table

Usage

rtf_body(
  tbl,
  colheader = TRUE,
  page_width = 8.5,
  page_height = 11,
  orientation = "portrait",
  doctype = "wma",
  border_left = "single",
  border_right = "single",
  border_top = NULL,
  border_bottom = "double",
  border_color_left = NULL,
  border_color_right = NULL,
  border_color_top = NULL,
  border_color_bottom = NULL,
  border_width = 15,
  col_rel_width = NULL,
  col_total_width = page_width/1.4,
  cell_height = 0.15,
  cell_justification = "c",
  text_font = 1,
  text_format = NULL,
  text_color = NULL,
  text_background_color = NULL,
  text_justification = "c",
  text_font_size = 9,
  text_space_before = 15,
  text_space_after = 15,
  page_num = NULL,
  page_by = NULL,
  new_page = FALSE,
  last_row = TRUE
)

Arguments

tbl

A data frame

colheader

A boolean value to indicate whether to add default column header to the table

page_width

page width in inches

page_height

page height in inches

orientation

Orientation in 'portrait' or 'landscape'

doctype

doctype in 'csr', 'wma', or 'wmm'

border_left

left border type

border_right

right border type

border_top

top border type

border_bottom

bottom border type

border_color_left

left border color

border_color_right

right border color

border_color_top

top border color

border_color_bottom

bottom border color

border_width

border width in twips

col_rel_width

column relative width in a vector eg. c(2,1,1) refers to 2:1;1

col_total_width

column total width for the table

cell_height

height for cell in twips

cell_justification

justification for cell

text_font

text font type

text_format

text format

text_color

text color

text_background_color

text background color

text_justification

justification for text

text_font_size

text font size

text_space_before

line space before text

text_space_after

line space after text

page_num

number of rows in each page

page_by

column names to group by table in sections

new_page

a boolean value to indicate whether to separate grouped table into pages by sections

last_row

a boolean value to indicate whether the table contains the last row of the final table

Value

the same data frame tbl with additional attributes for table body

Examples

Run this code
# NOT RUN {
library(dplyr) # required to run examples
data(tbl_1)
tbl_1 %>%
  rtf_body(col_rel_width = c(3,1,3,1,3,1,3,5),
           text_justification = c("l",rep("c",7)),
           last_row = FALSE) %>%
  attributes()

# }

Run the code above in your browser using DataLab