create_rd_table {riskdiff} | R Documentation |
Create Formatted Table of Risk Difference Results
Description
Creates a publication-ready table of risk difference results with appropriate grouping and formatting. Requires the kableExtra package for full functionality.
Usage
create_rd_table(
results,
caption = "Risk Differences",
include_model_type = FALSE,
...
)
Arguments
results |
Results tibble from calc_risk_diff() |
caption |
Table caption (default: "Risk Differences") |
include_model_type |
Whether to include model type column (default: FALSE) |
... |
Additional arguments passed to kableExtra::kable() |
Value
If kableExtra is available, returns a kable table object suitable for rendering in R Markdown or HTML. The table includes formatted risk differences, confidence intervals, and p-values with appropriate styling and footnotes. If kableExtra is not available, returns a formatted tibble with the same information in a basic data frame structure.
Examples
data(cachar_sample)
results <- calc_risk_diff(cachar_sample, "abnormal_screen", "smoking")
# Basic table (works without kableExtra)
basic_table <- create_rd_table(results, caption = "Risk of Abnormal Cancer Screening")
print(basic_table)
# Enhanced table (requires kableExtra)
if (requireNamespace("kableExtra", quietly = TRUE)) {
enhanced_table <- create_rd_table(
results,
caption = "Risk of Abnormal Cancer Screening by Smoking Status",
include_model_type = TRUE
)
print(enhanced_table)
}
[Package riskdiff version 0.2.1 Index]