stable_long: Create longtable output from an R data frame

View source: R/table-long.R

stable_longR Documentation

Create longtable output from an R data frame

Description

Use this function to allow your table to span multiple pages, with a "to be continued" statement at the bottom of each page. There are important differences between this longtable environment and the tabular environment that is used to generate tables from stable(). See the details section for more information.

Usage

stable_long(data, ...)

## S3 method for class 'data.frame'
stable_long(
  data,
  note_config = noteconf(type = "minipage"),
  inspect = FALSE,
  lt_cap_macro = "",
  lt_cap_text = "",
  lt_cap_short = "",
  lt_cap_label = "",
  lt_continue = "\\footnotesize{continued on next page}",
  ...
)

## S3 method for class 'stobject'
stable_long(data, ...)

## S3 method for class 'pmtable'
stable_long(data, ...)

Arguments

data

an object to render as a long table; this could be a data.frame, a pmtable object or an stobject; when passing in a data.frame, the data should be filtered or subset so that data contains exactly the rows (and columns) to be processed; pmtables will not add or remove rows prior to processing data

...

passed to stable()

note_config

a noteconf() object used to configure how table notes are displayed; see also st_noteconf().

inspect

fixed to TRUE and passed to stable()

lt_cap_macro

the name of a macro that will hold caption text; to not lead with ⁠\\⁠ - this will be added for you

lt_cap_text

full caption text, appearing where the table is rendered

lt_cap_short

short caption text, appearing in the list of tables

lt_cap_label

table label for use in latex document

lt_continue

longtable continuation message

Details

To create longtable output, pmtables first passes the data frame through stable() and then modifies the output to create a table in longtable environment. The ... arguments to stable_long() are passed to stable() and can be used to configure the table. One important difference between tablular and longtable environments is that captions need to get inserted inside the longtable environment; this is why you see several additional arguments for stable_long().

You may have to run pdflatex on your longtable more than once to get the table to render properly; this is not unexpected behavior for longtable.

If you have panels in your table, the default is to prevent page breaks right after the panel title row using the ⁠\\*⁠ command in the longtable package. This shouldn't need to be changed by the user, but if needed this can be suppressed by adding nopagebreak = FALSE when calling as.panel() or rowpanel().

Value

A character vector with the TeX code for the table with class attribute set to stable_long and stable.

Examples

stable_long(stdata())


metrumresearchgroup/pmtables documentation built on Dec. 22, 2024, 1:34 a.m.