Skip to content
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/z_copilot-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ body:
attributes:
value: |
**Setup preference guide:**
- **copilot-setup-full** (default label): For code changes, new features, function modifications, or tasks requiring complete R development environment.
- For documentation changes, minor fixes, configuration updates, or tasks that don't require full R environment (saves 5-10 minutes), remove the **copilot-setup-full** label before creating the issue.
- 🔴 **copilot-setup-full** (default label): For code changes, new features, function modifications, or tasks requiring complete R development environment.
- 🔵 For documentation changes, minor fixes, configuration updates, or tasks that don't require full R environment (saves 5-10 minutes), remove the **copilot-setup-full** label before creating the issue.
17 changes: 11 additions & 6 deletions R/report.estimate_contrasts.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,20 @@
#'
#' @inherit report return seealso
#'
# nolint start
#' @examplesIf all(insight::check_if_installed(c("modelbased", "marginaleffects", "collapse", "Formula"), quietly = TRUE))
# nolint end
#' library(modelbased)
#' model <- lm(Sepal.Width ~ Species, data = iris)
#' contr <- estimate_contrasts(model)
#' report(contr)
#' @return An object of class [report()].
#' @export
report.estimate_contrasts <- function(x, ...) {
table <- report_table(x, ...)
text <- report_text(x, table = table, ...)
report_table_obj <- report_table(x, ...)
report_text_obj <- report_text(x, table = report_table_obj, ...)

as.report(text, table = table, ...)
as.report(report_text_obj, table = report_table_obj, ...)
}

# report_table ------------------------------------------------------------
Expand All @@ -38,15 +40,18 @@ report_table.estimate_contrasts <- function(x, ...) {
report_text.estimate_contrasts <- function(x, table = NULL, ...) {
f_table <- insight::format_table(table)

text <- paste0("The difference between ", x$Level1, " and ", x$Level2, " is ",
report_text_obj <- paste0("The difference between ", x$Level1, " and ", x$Level2, " is ",
ifelse(x$Difference < 0, " negative", "positive"), " and statistically ",
ifelse(x$p < 0.05, "significant", "non-significant"),
" (difference = ", f_table$Difference, ", 95% CI ", f_table$`95% CI`, ", ",
names(f_table)[6], " = ", f_table[[6]], ", ", insight::format_p(table$p), ")",
collapse = ". "
)

text <- paste("The marginal contrasts analysis suggests the following.", paste(text, collapse = ""))
report_text_obj <- paste(
"The marginal contrasts analysis suggests the following.",
paste(report_text_obj, collapse = "")
)

as.report_text(text)
as.report_text(report_text_obj)
}