Add Table Body Attributes to the Table
rtf_body(
tbl,
col_rel_width = rep(1, ncol(tbl)),
as_colheader = TRUE,
border_left = "single",
border_right = "single",
border_top = "",
border_bottom = "",
border_first = "single",
border_last = "single",
border_color_left = NULL,
border_color_right = NULL,
border_color_top = NULL,
border_color_bottom = NULL,
border_color_first = NULL,
border_color_last = NULL,
border_width = 15,
cell_height = 0.15,
cell_justification = "c",
cell_nrow = NULL,
text_font = 1,
text_format = NULL,
text_font_size = 9,
text_color = NULL,
text_background_color = NULL,
text_justification = "c",
text_indent_first = 0,
text_indent_left = 0,
text_indent_right = 0,
text_space = 1,
text_space_before = 15,
text_space_after = 15,
text_convert = TRUE,
group_by = NULL,
page_by = NULL,
new_page = FALSE,
pageby_header = TRUE,
last_row = TRUE
)
A data frame.
Column relative width in a vector e.g. c(2,1,1) refers to 2:1:1. Default is NULL for equal column width.
A boolean value to indicate whether to add default column header to the table. Default is TRUE to use data frame column names as column header.
Left border type. Default is "single". To vary left border by column, use
character vector with length of vector equal to number of columns displayed
e.g. c("single","single","single"). All possible input can be found in
r2rtf:::border_type()$name
.
Right border type. Default is "single". To vary right border by column, use
character vector with length of vector equal to number of columns displayed
e.g. c("single","single","single"). All possible input can be found in
r2rtf:::border_type()$name
.
Top border type. Default is NULL. To vary top border by column, use
character vector with length of vector equal to number of columns displayed
e.g. c("single","single","single"). If it is the first row in a table for this
page, the top border is set to "double" otherwise the border is set to "single".
All possible input can be found in r2rtf:::border_type()$name
.
Bottom border type. Default is "double" indicating double line bottom border.
To vary bottom border by column, use character vector with length of vector
equal to number of columns displayed e.g. c("single","single","single").
All possible input can be found in r2rtf:::border_type()$name
.
First top border type of the whole table. Default is "double" indicating double line bottom border.
All possible input can be found in r2rtf:::border_type()$name
.
Last bottom border type of the whole table. Default is "double" indicating double line bottom border.
All possible input can be found in r2rtf:::border_type()$name
.
Left border color type. Default is NULL for black. To vary left
border color by column, use character vector with length of vector
equal to number of columns displayed e.g. c("white","red","blue").
All possible input can be found in grDevices::colors()
.
Right border color type. Default is NULL for black. To vary right
border color by column, use character vector with length of vector
equal to number of columns displayed e.g. c("white","red","blue").
All possible input can be found in grDevices::colors()
.
Top border color type. Default is NULL for black. To vary top
border color by column, use character vector with length of vector
equal to number of columns displayed e.g. c("white","red","blue").
All possible input can be found in grDevices::colors()
.
Bottom border color type. Default is NULL for black. To vary bottom
border color by column, use character vector with length of vector
equal to number of columns displayed e.g. c("white","red","blue").
All possible input can be found in grDevices::colors()
.
First top border color type of the whole table. Default is NULL for black.
All possible input can be found in grDevices::colors()
.
Last bottom border color type of the whole table. Default is NULL for black.
All possible input can be found in grDevices::colors()
.
Border width in twips. Default is 15 for 0.0104 inch.
Cell height in inches. Default is 0.15 for 0.15 inch.
Justification type for cell. Default is "c" for center justification.
All possible input can be found in r2rtf:::justification()$type
.
Number of rows required in each cell. Default is NULL.
Text font type. Default is 1 for Times New Roman. To vary text font type
by column, use numeric vector with length of vector equal to number of
columns displayed e.g. c(1,2,3).All possible input can be found
in r2rtf:::font_type()$type
.
Text format type. Default is NULL for normal. Combination of format type
are permitted as input for e.g. "ub" for bold and underlined text. To vary
text format by column, use character vector with length of vector equal to
number of columns displayed e.g. c("i","u","ib"). All possible input
can be found in r2rtf:::font_format()$type
.
Text font size. Default is 9. To vary text font size by column, use numeric vector with length of vector equal to number of columns displayed e.g. c(9,20,40).
Text color type. Default is NULL for black. To vary text color by column,
use character vector with length of vector equal to number of columns
displayed e.g. c("white","red","blue"). All possible input can be found
in grDevices::colors()
.
Text background color type. Default is NULL for white. To vary
text color by column, use character vector with length of vector
equal to number of columns displayed e.g. c("white","red","blue").
All possible input can be found in grDevices::colors()
.
Justification type for text. Default is "c" for center justification.
To vary text justification by column, use character vector with
length of vector equal to number of columns displayed e.g. c("c","l","r").
All possible input can be found in r2rtf:::justification()$type
.
A value of first indent.
A value of left indent.
A value of right indent.
A value of text space.
Line space before text in twips. Default is 15 for 0.0104 inch.
Line space after text in twips. Default is 15 for 0.0104 inch.
A logical value to convert special characters. Default is TRUE.
A character vector of variable names in tbl
.
Column names in a character vector to group by table in sections. Default is NULL.
A boolean value to indicate whether to separate grouped table into pages by sections. Default is FALSE.
A boolean value to display pageby header at the beginning of each page.
A boolean value to indicate whether the table contains the last row of the final table. Default is TRUE.
the same data frame tbl
with additional attributes for table body
The contents of this section are shown in PDF user manual only.
# 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