View source: R/data_frame_from_2x2.R
data_frame_from_2x2 | R Documentation |
create a data frame from a 2x2 matrix
data_frame_from_2x2(x)
x |
a 2x2 matrix or 3D array with exposure variable in rows and outcome in columns |
a data frame with the important combinations:
A_exp_cases
B_exp_controls
C_unexp_cases
D_unexp_controls
total_cases (A + B)
total_controls (C + D)
total_exposed (A + C)
total_unexposed (B + D)
total (A + B + C + D)
arr <- c(10, 35, 90, 465, 36, 25, 164, 175)
arr <- array(arr,
dim = c(2, 2, 2),
dimnames = list(
risk = c(TRUE, FALSE),
outcome = c(TRUE, FALSE),
old = c(FALSE, TRUE)
)
)
arr
data_frame_from_2x2(arr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.