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

Refactor resolver to nudge to adding row names to columns + improve error message + refactor tests #1770

Merged
merged 8 commits into from
Jul 12, 2024

Conversation

olivroy
Copy link
Collaborator

@olivroy olivroy commented Jul 11, 2024

Summary

In short the stub created when rownames are not present prevents us from using row names.

I noticed that a way to find out this is to notice that all items are NA, it means they don't exist.

Instead of showing which row names couldn't be resolved, nudge towards adding row names to the gt table instead.

I also took advantage of this PR to remove a duplicate test in test-tab_style.R and merge the tests for output + deprecated arguments.

I have to say that I didn't know the existence of tab_row_group() before. I think this function should be deprecated in favour of a case_match() syntax.

# not the best name, but similar syntax as another one.
stub_row_group <- function(..., .default) {
}
exibble |>
  gt(rowname_col = ) |>
  stub_rows_group(
     c(1, 2) ~ "grp1",
    .default = "Other"
  )

Honestly, I would have had trouble finding tab_options(row_group.default_label) without trying the others_label first and getting the nudge there. (It is documented, but still feels like not the best design). Oh, this is #729!

Related GitHub Issues and PRs

fix #1535

Checklist

Copy link
Member

@rich-iannone rich-iannone left a comment

Choose a reason for hiding this comment

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

LGTM!

@rich-iannone rich-iannone merged commit 37ad5a6 into rstudio:master Jul 12, 2024
12 checks passed
@olivroy olivroy deleted the issue1535 branch July 15, 2024 20:15
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.

tab_row_group() does not recognize row names
2 participants