Given a data frame, a risk factor column, and an outcome column, calculate odds ratio via epitools::oddsratio(). Allows non-standard evaluation for use in dplyr pipes.

odds_ratio(df, exposure, outcome)

Arguments

df

a data frame

exposure

a logical vector representing a risk factor or exposure

outcome

a logical vector representing an outcome

Value

a list object produced by epitools::oddsratio()

Examples

df <- data.frame(poison = c(TRUE, TRUE, FALSE, FALSE), death = c(TRUE, FALSE, TRUE, FALSE)) df %>% odds_ratio(poison, death)
#> $data #> death #> poison FALSE TRUE Total #> FALSE 1 1 2 #> TRUE 1 1 2 #> Total 2 2 4 #> #> $measure #> odds ratio with 95% C.I. #> poison estimate lower upper #> FALSE 1 NA NA #> TRUE 1 0.0130576 76.58377 #> #> $p.value #> two-sided #> poison midp.exact fisher.exact chi.square #> FALSE NA NA NA #> TRUE 1 1 1 #> #> $correction #> [1] FALSE #> #> attr(,"method") #> [1] "median-unbiased estimate & mid-p exact CI"