You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ard<-mtcars|>cards::ard_continuous(
variables= c("mpg", "hp"),
statistics=~list(
mean= \(x) mean(x),
mean_warn= \(x) {warning("This is your warning!"); mean(x)},
errr= \(x) stop("That's it! STOP!")
)
)
ardprint_messages<-function(x) {
ard_warning<-x|>dplyr::filter(cards:::map_lgl(.data$warning, Negate(is.null)))
ard_error<-x|>dplyr::filter(cards:::map_lgl(.data$error, Negate(is.null)))
# this section needs to be updated to: # 1. add the variable level if populated# 2. add the grouping variables/levels if populatedcli::cli_bullets(c(
"The following warnings were observed:",
"!"="Variable {.var {ard_warning$variable[[1]]}} for statistic {.val {ard_warning$stat_name[[1]]}}: {cli::col_yellow(ard_warning$warning[[1]])}",
"!"="Variable {.var {ard_warning$variable[[2]]}} for statistic {.val {ard_warning$stat_name[[2]]}}: {cli::col_yellow(ard_warning$warning[[2]])}"
))
cli::cli_bullets(c(
"The following errors occured:",
"x"="Variable {.var {ard_error$variable[[1]]}} for statistic {.val {ard_error$stat_name[[1]]}}: {cli::col_red(ard_error$error[[1]])}",
"x"="Variable {.var {ard_error$variable[[2]]}} for statistic {.val {ard_error$stat_name[[2]]}}: {cli::col_red(ard_error$error[[2]])}"
))
}
print_messages(ard)
For ARDs like ard_ttest() we can have one error for every statistic returned. In these cases, the messages should be grouped by the groups, variables, and error message. We can list all the statistics the error applies applies to.
The text was updated successfully, but these errors were encountered:
**What changes are proposed in this pull request?**
Adds the `print_ard_conditions()` function
**Reference GitHub issue associated with pull request.** _e.g., 'closes#1'_
closes#118
<img width="850" alt="image"
src="https://github.com/insightsengineering/cards/assets/26774684/bb62e550-734f-45a3-b149-8488ef3e3816">
--------------------------------------------------------------------------------
Reviewer Checklist (if item does not apply, mark is as complete)
- [ ] Ensure all package dependencies are installed:
`devtools::install_dev_deps()`
- [ ] PR branch has pulled the most recent updates from master branch:
`usethis::pr_merge_main()`
- [ ] If a bug was fixed, a unit test was added.
- [ ] Run `pkgdown::build_site()`. Check the R console for errors, and
review the rendered website.
- [ ] Code coverage is suitable for any new functions/features:
`devtools::test_coverage()`
- [ ] `usethis::use_spell_check()` runs with no spelling errors in
documentation
When the branch is ready to be merged:
- [ ] Update `NEWS.md` with the changes from this pull request under the
heading "`# cards (development version)`". If there is an issue
associated with the pull request, reference it in parentheses at the end
update (see `NEWS.md` for examples).
- [ ] Increment the version number using `usethis::use_version(which =
"dev")`
- [ ] Run `usethis::use_spell_check()` again
- [ ] Approve Pull Request
- [ ] Merge the PR. Please use "Squash and merge".
---------
Signed-off-by: Daniel Sjoberg <danield.sjoberg@gmail.com>
Perhaps something like this:
For ARDs like
ard_ttest()
we can have one error for every statistic returned. In these cases, the messages should be grouped by the groups, variables, and error message. We can list all the statistics the error applies applies to.The text was updated successfully, but these errors were encountered: