risk | R Documentation |
Calculate risk ratios and risk differences
risk(data, exposure, outcome, ci_level = 95)
data |
A dataframe |
exposure |
Variable giving the levels of the outcome |
outcome |
Variable giving cases (1) or non-cases (0) |
ci_level |
a string giving the confidence interval |
A dataframe with the risk ratio, risk difference and confidence intervals
# Data from stratum 1 of table 15-1., p260
dat <- data.frame(
exposure_var = c(rep(1, 8), rep(0, 5), rep(1, 98), rep(0, 115)),
outcome_var = c(rep(1, 8), rep(1, 5), rep(0, 98), rep(0, 115)),
stringsAsFactors = FALSE
)
risk(data = dat, exposure = exposure_var, outcome = outcome_var)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.