Learn R Programming

r2rtf (version 0.1.1)

rtf_colheader: Add column header to the table

Description

Add column header to the table

Usage

rtf_colheader(
  tbl,
  colheader = NULL,
  border_left = "single",
  border_right = "single",
  border_top = NULL,
  border_bottom = "",
  border_color_left = NULL,
  border_color_right = NULL,
  border_color_top = NULL,
  border_color_bottom = NULL,
  border_width = 15,
  cell_justification = "c",
  col_rel_width = NULL,
  page_width = 8.5,
  col_total_width = page_width/1.4,
  cell_height = 0.15,
  text_justification = "c",
  text_font = 1,
  text_format = NULL,
  text_color = NULL,
  text_background_color = NULL,
  text_font_size = 9,
  text_space_before = 15,
  text_space_after = 15,
  first_row = FALSE
)

Arguments

tbl

A data frame

colheader

A string that uses " | " to separate column names.

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

cell_justification

justification for cell

col_rel_width

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

page_width

page width in inches

col_total_width

column total width for the table

cell_height

height for cell in twips

text_justification

justification for text

text_font

text font type

text_format

text format

text_color

text color

text_background_color

text background color

text_font_size

text font size

text_space_before

line space before text

text_space_after

line space after text

first_row

boolean value to indicate whether column header is the first row of the table

Value

the same data frame tbl with additional attributes for table column header

Examples

Run this code
# NOT RUN {
library(dplyr) # required to run examples
data(tbl_1)
tbl_1 %>%
  rtf_colheader(colheader = "Treatment | N | Mean (SD) | N | Mean (SD) | N |
                  Mean (SD) | LS Mean (95% CI)\\dagger") %>%
  attr("rtf_colheader")

# }

Run the code above in your browser using DataLab