Learn R Programming

patchwork (version 1.3.0)

wrap_table: Wrap a table in a patchwork compliant patch

Description

This function works much like wrap_elements() in that it turns the input into patchwork compliant objects that can be added to a composition. However, wrap_table() uses the knowledge that the input is a table to provide some very nifty layout options that makes it generally better to use than wrap_elements() for this type of object.

Usage

wrap_table(
  table,
  panel = c("body", "full", "rows", "cols"),
  space = c("free", "free_x", "free_y", "fixed"),
  ignore_tag = FALSE
)

Value

A wrapped_table object

Arguments

table

A gt table or an object coercible to a data frame

panel

what portion of the table should be aligned with the panel region? "body" means that any column and row headers will be placed outside the panel region, i.e. the topleft corner of the panel region will be aligned with the topleft data cell. "full" means that the whole table will be placed inside the panel region. "rows" means that all rows (including column headers) will be placed inside the panel region but row headers will be placed to the left. "cols" is the opposite, placing all columns within the panel region but keeping the column header on top of it. If this is set to "body" or "cols" and space is set to "fixed" or "free_x" then any footnotes or source notes in the table will be placed outside the bottom of the panel region.

space

How should the dimension of the table influence the final composition? "fixed" means that the table width will set the width of the column it occupies and the table height will set the height of the row it occupies. "free" is the opposite meaning that the table dimension will not have any influence on the sizing. "free_x" and "free_y" allows you to free either direction while keeping the remaining fixed. Do note that if you set a specific width or height in plot_layout() it will have higher priority than the table dimensions

ignore_tag

Should tags be ignored for this patch. This is relevant when using automatic tagging of plots and the content of the patch does not qualify for a tag.