add_body: Add a table body (a df) to the tab.

Description Usage Arguments Examples

Description

Add a table body (a df) to the tab.

Usage

1
2
3
4
add_body(tab, df, left_header_colnames = NULL, row_style_names = NULL,
  left_header_style_names = NULL, col_style_names = NULL,
  fill_non_values_with = list(na = NULL, nan = NULL, inf = NULL, neg_inf =
  NULL))

Arguments

tab

The core tab object

df

A data frame containing the data you want to write to write to Excel

left_header_colnames

The names of the columns in the df which are left headers, as opposed to the main body

row_style_names

Manually specify the styles that apply to each row (as opposed to using the autodetect functions). Styles provided must be present in the style catalogue

left_header_style_names

Manually specify the addition styles that will apply to cells in the left headers. Must be present in styles catalogue

col_style_names

Manually specify the additional styles that will be applied to each column. Must be present in styles catalogue

fill_non_values_with

Manually specify a list of strings that will replace non numbers types NA, NaN, Inf and -Inf. e.g. list(na = '*', nan = ”, inf = '-', neg_inf = '–'). Note: NaNs are not treated as NAs.

Examples

1
2
3
4
5
6
7
crosstab <- read.csv(system.file("extdata", "example_crosstab.csv", package="xltabr"))
tab <- initialise()

# Note you could also use xltabr::auto_detect_left_headers
colnames <- c("drive", "age")
lh_styles <- "left_header"
tab <- add_body(tab, crosstab, left_header_colnames = colnames, left_header_style_names = lh_styles)

xltabr documentation built on May 2, 2019, 9:11 a.m.

Related to add_body in xltabr...