Create tabular output from an R data frame

stable(data, ...)

# S3 method for class 'data.frame'
stable(
  data,
  align = cols_left(),
  panel = NULL,
  span = NULL,
  notes = NULL,
  sumrows = NULL,
  units = NULL,
  drop = NULL,
  sizes = tab_size(),
  caption = NULL,
  control = st_control(),
  escape_fun = tab_escape,
  inspect = FALSE,
  ...
)

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

# S3 method for class 'stable'
stable(data, ...)

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

Arguments

data

a data.frame to convert to tabular table; the user should filter 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; see also st_new()

...

passed to other functions: tab_hlines(), tab_spanners(), tab_notes(), tab_cols(), tab_clear_reps() and make_tabular()

align

an alignment object created by cols_align(), cols_left(), cols_center(), or cols_right(); see also st_align()

panel

character column name to use to section the table; sections will be created from unique values of data[[panel]]; see also st_panel()

span

a list of objects created with colgroup(); ; see also st_span()

notes

a character vector of notes to include at the foot of the table; use r_file and output_file for source code and output file annotations; see tab_notes() for arguments to pass in order to configure the way notes appear in the output; see also st_notes()

sumrows

an object created with sumrow(); identifies summary rows and adds styling; see also st_sumrow()

units

a named list with unit information; names should correspond to columns in the data frame

drop

columns to remove prior to rendering the table

sizes

an object returned from tab_size()

caption

a caption for the table; this could be raw caption text or a caption object created with as.caption()

control

not used at the moment

escape_fun

a function passed to prime_fun that will sanitize column data

inspect

if TRUE, extra information is attached to the output as an attribute called stable_data; see get_stable_data()

Examples

data <- ptdata()

a <- stable(data, r_file = "example.R", output_file = "output.tex")

b <- stable(data, panel = "STUDY")

c <- stable(data, span = colgroup("Covariates", STUDY:ALB))