Description Usage Arguments Details Author(s) See Also Examples
expandTables
generates a data frame and supports two levels.
1 2 3 4 5 6 7 8 9 | expandTables(
...,
exp_name = "exposure",
exp_lvl = c("exposed", "unexposed"),
case_name = "outcome",
case_lvl = c("disease", "healthy"),
strata_name = "strata",
stringsAsFactors = FALSE
)
|
... |
vectors of 2x2 tables |
exp_name |
Name of |
exp_lvl |
Names of two categories in the order of Exposed and non-exposed |
case_name |
Name of |
case_lvl |
names of two categories in the order of |
strata_name |
Name of stratified variable |
stringsAsFactors |
logical: should the character vector be converted to a factor? Disease and healthy |
expandTables
uses the vectors of 2x2 tables and generates a data frame of three
columns: Exposure, Outcome and Strata, intended for calculations
of stratified 2x2 tables using Mantel Haenszel methods.
Myo Minn Oo (Email: dr.myominnoo@gmail.com | Website: https://myominnoo.github.io/)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ## Not run:
## one table
tab <- expandTables(c(60, 140, 60, 40))
xtab(tab, exposure)
## one table with full labels
tab <- expandTables(c(60, 140, 60, 40), exp_name = "Type of area",
exp_lvl = c("Rural", "urban"),
case_name = "Antibodies",
case_lvl = c("Yes", "No"))
xtab(tab)
## 2 tables
tab <- expandTables(male = c(36, 14, 50, 50),
female = c(24, 126, 10, 90),
exp_name = "Type of area", exp_lvl = c("Rural", "Urban"),
case_name = "Antibodies", case_lvl = c("Yes", "No"),
strata_name = "gender")
### checking numbers
tab %>%
pick(gender == "male") %>%
xtab(`Type of area`, `Antibodies`, .)
tab %>%
pick(gender == "female") %>%
xtab(`Type of area`, `Antibodies`, .)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.