Bug Description
model_parameters() throws an error when applied to a fisher.test() object generated from a contingency table larger than 2x2.
While 2x2 tables generate an odds ratio and run successfully, larger tables do not compute an odds ratio. This results in a mismatched row error when the function attempts to build the summary table.
Reproducible Example
library(parameters)
# 2x2 table works (produces an odds ratio)
fisher.test(mtcars$am, mtcars$vs) |>
model_parameters()
#> Fisher's Exact Test for Count Data
#>
#> Odds Ratio | 95% CI | p
#> ----------------------------------
#> 1.96 | [0.38, 10.59] | 0.473
#>
#> Alternative hypothesis: true odds ratio is not equal to 1
# 3x3 table fails (no odds ratio produced)
fisher.test(mtcars$cyl, mtcars$gear) |>
model_parameters()
#> Error in `data.frame()`:
#> ! arguments imply differing number of rows: 0, 1
Created on 2026-03-06 with reprex v2.1.1
Expected Behavior
The function should handle this missing data gracefully. It would be highly helpful if it either returned the p-value with NA for missing statistics (similar to broom::tidy()), or returned an informative error message explaining that odds ratios are not supported for Fisher's Exact Test on tables larger than 2x2.
Bug Description
model_parameters()throws an error when applied to afisher.test()object generated from a contingency table larger than 2x2.While 2x2 tables generate an odds ratio and run successfully, larger tables do not compute an odds ratio. This results in a mismatched row error when the function attempts to build the summary table.
Reproducible Example
Created on 2026-03-06 with reprex v2.1.1
Expected Behavior
The function should handle this missing data gracefully. It would be highly helpful if it either returned the p-value with
NAfor missing statistics (similar tobroom::tidy()), or returned an informative error message explaining that odds ratios are not supported for Fisher's Exact Test on tables larger than 2x2.