ir_crosstab: Calculate crude incidence rates and crosstabulate results by...

Description Usage Arguments Value

View source: R/ir_crosstab.R

Description

Calculate crude incidence rates and crosstabulate results by break variables

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ir_crosstab(
  df,
  dattype = "zfkd",
  count_var,
  xbreak_var = "none",
  ybreak_vars,
  collapse_ci = FALSE,
  add_total = "no",
  add_n_percentages = FALSE,
  futime_var = NULL,
  alpha = 0.05
)

Arguments

df

dataframe in wide format

dattype

can be "zfkd" or "seer" or empty. Will set default variable names from dataset.

count_var

variable to be counted as observed case. Should be 1 for case to be counted.

xbreak_var

variable from df by which rates should be stratified in columns of result df. Default is "none".

ybreak_vars

variables from df by which rates should be stratified in rows of result df. Multiple variables will result in appended rows in result df. y_break_vars is required.

collapse_ci

If TRUE upper and lower confidence interval will be collapsed into one column separated by "-". Default is FALSE.

add_total

option to add a row of totals. Can bei either "no" for not adding such a row or "top" or "bottom" for adding it at the first or last row. Default is "no".

add_n_percentages

option to add a column of percentages for n_base in its respective yvar_group. Can only be used when xbreak_var = "none". Default is FALSE.

futime_var

variable in df that contains follow-up time per person (in years). Default is set if dattype is given.

alpha

signifcance level for confidence interval calculations. Default is alpha = 0.05 which will give 95 percent confidence intervals.

Value

df


marianschmidt/msSPChelpR documentation built on March 21, 2020, 11:49 p.m.