HRtable: Function to compile HR-table.

Description Usage Arguments Value Examples

View source: R/HRtable.R

Description

Function to compile HR-table.

Usage

1
2
3
4
HRtable(data, this.outcome, info, sign.digits = 2, sign.digits.HR = 3,
  pvalue.digits = 3, pvalue.cutoff = 0.001, test.input = FALSE,
  factor.level.bullet = "- ", less.than.character = "< ",
  linebreak.tag = "")

Arguments

data

A data frame that contains the baseline (BL) data (one row per participant).

this.outcome

A text string as input for survival::coxph, e.g., "Surv(Follow_up_Years, Event_Death)" (incl. the quotes). This string will be passed to coxph as the left-side of the model equation with as.formula(paste(this.outcome, " ~ ", this.var, sep = ""))

info

A data frame with specifications for the HR-table. (See Examples below.)

sign.digits

Digits used for parameter estimates

sign.digits.HR

Digits used for hazard ratios and conf. intervals

pvalue.digits

Digits used for p-values

pvalue.cutoff

Cutoff for changing p-values to simply 'smaller than', e.g., p < 0.001

test.input

Whether the input is tested for logical consistency. Warning: testing is not comprehensive. Setting test.input = FALSE will bypass logical tests.

factor.level.bullet

The character to be prepended to factor levels (listing). The default is factor.level.bullet = "- " (hyphen/minus) but it can be reset to any character string. If the result is passed on to html-rendering an en-dash can be produced by factor.level.bullet = "&#8211; " (HTML-code for the en-dash). Other useful options for (subsequent) HTML-rendering: factor.level.bullet = "&nbsp; &nbsp; " forces non-breaking space and effectively leads to indentation of factor levels; factor.level.bullet = "&#187; " prints right double angle quotes in HTML.

less.than.character

The character to be prepended to the cutoff-value for the p-values (e.g., '< 0.001'). The default is less.than.character = "< " but it can be reset to any character string. If the result is passed on to html-rendering this symbol can be produced by less.than.character = "&lt; " (HTML-friendly name for 'less than' since '<' is used in HTML-tags and might not render correctly as a character; e.g., when using function htmlTable() in the htmlTable-package).

linebreak.tag

Can be used to insert a linebreak-command in the table headers to bring the counts to a new line. The default is linebreak.tag = "" effectively not inserting any such command. For subsequent HTML-rendering linebreak.tag = "<br>" (HTML tag to insert a single line break) is useful.

Value

An R character-matrix containing the compiled table information.

Examples

1
2
3
4
5
## Not run: 
HRtable(data = example_data, info = example_variables,
  this.outcome = "Surv(Follow_up_Years, Event_Death)", test.input = TRUE)

## End(Not run)

FrThomas/risyphus documentation built on Dec. 6, 2019, 6:27 a.m.