Create a printable table of a person-years result.

```
# S3 method for pyears
summary(object, header = TRUE, call = header, n = TRUE,
event = TRUE, pyears = TRUE, expected = TRUE, rate = FALSE, rr =expected,
ci.r = FALSE, ci.rr = FALSE, totals=FALSE, legend = TRUE, vline = FALSE,
vertical= TRUE, nastring=".", conf.level = 0.95,
scale = 1, ...)
```

object

a pyears object

header

print out a header giving the total number of observations, events, person-years, and total time (if any) omitted from the table

call

print out a copy of the call

n, event, pyears, expected

logical arguments: should these elements be printed in the table?

rate, ci.r

logical arguments: should the incidence rate and/or its confidence interval be given in the table?

rr, ci.rr

logical arguments: should the hazard ratio and/or its confidence interval be given in the table?

totals

should row and column totals be added?

legend

should a legend be included in the printout?

vline

should vertical lines be included in the printed tables?

vertical

when there is only a single predictor, should the table be printed with the predictor on the left (vertical=TRUE) or across the top (vertical=FALSE)?

nastring

what to use for missing values in the table. Some of these are structural, e.g., risk ratios for a cell with no follow-up time.

conf.level

confidence level for any confidence intervals

scale

a scaling factor for printed rates

…

optional arguments which will be passed to the
`format`

function; common choices would be digits=2 or nsmall=1.

a copy of the object

The pandoc system has four table types: with or without vertical bars, and with single or multiple rows of data in each cell. This routine produces all 4 styles depending on options, but currently not all of them are recognized by the Rstudio-pandoc pipeline. (And we don't yet see why.)

The `pyears`

function is often used to create initial
descriptions of a survival or time-to-event variable; the type of
material that is often found in ``table 1'' of a paper. The summary
routine prints this information out using one of pandoc table styles.
A primary reason for choosing this style is that Rstudio is then able
to automatically render the results in multiple formats: html, rtf,
latex, etc.

If the `pyears`

call has only a single covariate then the table
will have that covariate as one margin and the statistics of interest
as the other.
If the `pyears`

call has two predictors then those two predictors
are used as margins of the table, while each cell of the table
contains the statistics of interest as multiple rows within the cell.
If there are more than two predictors then multiple tables are
produced, in the same order as the standard R printout for an array.

The "N" entry of a pyears object is the number of observations which
contributed to a particular cell. When the original call includes
`tcut`

objects then a single observation may contribute to
multiple cells.