CCTable | R Documentation |
CCTable is used for univariate analysis of case control studies with several exposures. The results are summarised in one table with one row per exposure making comparisons between exposures easier and providing a useful table for integrating into reports. Note that all variables need to be numeric and binary and coded as "0" and "1".
The results of this function contain: The name of exposure variables, the total number of cases, the number of exposed cases, the percentage of exposed among cases, the number of controls, the number of exposed controls, the percentage of exposed among controls, odds ratios, 95%CI intervals, p-values.
You can optionally choose to display the Fisher's exact p-value instead of the Chi squared p-value, with the option exact = TRUE.
You can specify the sort order, with the option sort = "or" to order by odds ratios. The default sort order is by p-values.
The option full = TRUE provides you with useful formatting information, which can be handy if you're using "markdown".
CCTable(x, cases, exposure = c(), exact = FALSE, sort = "pvalue", full = FALSE)
x |
data.frame |
cases |
character - cases binary variable (0 / 1) |
exposure |
character vector - exposure variables |
exact |
boolean - TRUE if you want the Fisher's exact p-value instead of CHI2 |
sort |
character - [pvalue, or, pe] sort by pvalue (default) or by odds ratio, or by percent exposed |
full |
boolean - TRUE if you need to display useful values for formatting |
The results of this function contain: The name of exposure variables, the total number of cases, the number of exposed cases, the percentage of exposed among cases, the number of controls, the number of exposed controls, the percentage of exposed among controls, odds ratios, 95%CI intervals, p-values.
You can optionally choose to display the Fisher???s exact p-value instead of the Chi squared p-value, with the option exact = TRUE.
You can specify the sort order, with the option sort=???or??? to order by odds ratios. The default sort order is by p-values.
The option "full = TRUE" provides you with useful formatting information, which can be handy if you're using "markdown".
list :
df |
data.frame - results table |
digits |
integer vector - digit number displayed for kable/xtable |
align |
character - alignment for kable/xtable |
- You can use the lowercase command "cctable" instead of "CCTable"
jean.pierre.decorps@gmail.com
cctable for Stata by *Gilles Desve* and *Peter Makary*.
CC, CCInter
library(EpiStats)
data(Tiramisu)
df <- Tiramisu
# You can see the association between several exposures and being ill.
cctable(df, "ill", exposure=c("wmousse", "tira", "beer", "mousse"))
# By storing results in res, you can also use individual elements of the results.
# For example if you would like to view a particular odds ratio,
# you can view it by typing (for example):
res = CCTable(df, "ill", exposure = c("wmousse", "tira", "beer", "mousse"), exact=TRUE)
res$df$OR[1]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.