Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fmt fn arg #83

Merged
merged 18 commits into from
Dec 22, 2023
Merged

Fmt fn arg #83

merged 18 commits into from
Dec 22, 2023

Conversation

bzkrouse
Copy link
Collaborator

What changes are proposed in this pull request?

Reference GitHub issue associated with pull request. e.g., 'closes #1'
closes #63


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".

@bzkrouse bzkrouse requested a review from ddsjoberg December 18, 2023 21:36
Copy link
Collaborator

@ddsjoberg ddsjoberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't get a chance to look at everything, but it's looking great. Thank you! A few comments so far

R/ard_continuous.R Outdated Show resolved Hide resolved
R/ard_continuous.R Outdated Show resolved Hide resolved
R/ard_continuous.R Outdated Show resolved Hide resolved
tests/testthat/_snaps/ard_categorical.md Outdated Show resolved Hide resolved
@ddsjoberg
Copy link
Collaborator

Hey hey! I was trying at various cases and found a bug I had written in compute_formula_selector(). The intended behavior is to select the last instruction when multiple are passed for the same variable, but it was selecting the first.

cards::compute_formula_selector(
    data = mtcars[c("mpg", "hp")],
    x = list(everything() ~ "THE DEFAULT", mpg = "Special for MPG")
)
#> $hp
#> [1] "THE DEFAULT"
#> 
#> $mpg
#> [1] "Special for MPG"

Created on 2023-12-21 with reprex v2.0.2

I fixed the bug in this PR and added a unit test because it's related to our implementation of fmt_fn=.

There is still the issue of filling the default formatting functions because the other fill function only fills defaults for top-level of the list, and not a list within a list. To keep this simple, I think I'll just make the default value fmt_fn=NULL and fill in the defaults in the function. I'll probably get to that tomorrow.

Copy link
Collaborator

@ddsjoberg ddsjoberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@ddsjoberg ddsjoberg merged commit d520097 into main Dec 22, 2023
9 checks passed
@ddsjoberg ddsjoberg deleted the fmt_fn-arg branch December 22, 2023 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Process ard_*(fmt_fn) argument like ard_*(stat_label)?
2 participants