Computes the odds ratio for every cells of the cross-tabulation between two categorical variables

or.table(x, y, weights = NULL, na.rm = FALSE, na.value = "NAs", digits = 3)

Arguments

x

the first categorical variable

y

the second categorical variable

weights

numeric vector of weights. If NULL (default), uniform weights (i.e. all equal to 1) are used.

na.rm

logical, indicating whether NA values should be silently removed before the computation proceeds. If FALSE (default), an additional level is added to the variables (see na.value argument).

na.value

character. Name of the level for NA category. Default is "NAs". Only used if na.rm = FALSE.

digits

integer. The number of digits (default is 3). If NULL, the results are not rounded.

Value

A table with the odds ratios

Author

Nicolas Robette

Examples

data(Movies)
or.table(Movies$Country, Movies$ArtHouse)
#>            No    Yes
#> Europe  1.127  0.887
#> France  0.166  6.020
#> Other   0.275  3.634
#> USA    11.150  0.090