epi_2by2: Wrap data from a dataframe and send to epiR::epi.2by2 (or...

View source: R/epi_2by2.R

epi_2by2R Documentation

Wrap data from a dataframe and send to epiR::epi.2by2 (or pass through table)

Description

A wrapper for epirR::epi.2by2 normally called with a data.frame and unquoted columns or expressions. Can also be called with a numeric vector length 4 to allow direct entry of 2 x 2 table data

Usage

epi_2by2(
  x,
  outcome = NULL,
  exposure = NULL,
  time_at_risk = NULL,
  method = "cross.sectional",
  ...
)

Arguments

x

A dataframe or numeric vector length 4

outcome

The unquoted column name for test results

exposure

The unquoted column name for exposure column

time_at_risk

Time at risk for cohort.time method

method

The type of study

...

Other parameters passed on to epiR::epi.2by2

Details

If using 4 numbers epi_2by2(a, b, c, d, ...)

Format is:

———– ———- ————-

Disease + - or time at risk

———– ———- ————-

Expose + a b

Expose - c d

———– ———- ————-

Total a + c b + d

———– ———- ————-

Value

Returns an epi.2by2 object

Examples

head(mtcars)
epi_2by2(mtcars, am == 1, cyl == 4, conf.level = 0.95)
epi_2by2(c(12, 34, 1, 6), conf.level = 0.95)

ianhandel/epidemr documentation built on April 13, 2022, 11:08 a.m.