Add row group id as an argument to tab_row_group()#699
Merged
rich-iannone merged 73 commits intomasterfrom Apr 5, 2021
Merged
Conversation
* master: do html_preserve hack for caption only when html_preserve is active Add tests; process_text now handles htmltools::tags, tagList Get table caption rewriting working for bookdown Update render_as_html.R Add the `create_caption_component_h()` fn Update helper-gt_attr_expectations.R Create TODOs and basics caption in HTML tables Update gt.Rd Augment the `dt_options_tbl` with `table_caption` Add `caption` arg in `gt()` Add the `caption` arg to `gt()` Add the `cols_merge_n_pct()` function (#683)
id as an argument to tab_row_group()
This is needed in the case that there are multiple instances of a delimeter in the column names to split.
* master: (26 commits) Remove irrelevant tests Update README Update license year info Update testthat tests Update _pkgdown.yml Update `cols_unhide()` to new tidyselect API Update test-table_parts.R Update PNG images for examples Update cols_unhide.Rd Update doc examples for `cols_unhide()` Update documentation with roxygen Add to NAMESPACE Add `dt_boxhead_set_not_hidden()` util fcn Modify internal documentation Add the `cols_unhide()` function Update intro-creating-gt-tables.Rmd Update gt-datasets.Rmd Update creating-summary-lines.Rmd Update case-study-gtcars.Rmd Convert columns to tidyselect semantics (#718) ...
Member
|
Just to note a limitation on the column splitting logic, if split_at_first_delim <- function(delim, str) {
delim <- gsub("\\E", "\\\\E", delim, fixed = TRUE)
m <- regexec(perl = TRUE,
paste0(
"^(.*?)\\Q", delim, "\\E(.*)$"
),
str
)
regmatches(str, m)
}
split_at_first_delim("\\E", "foEo\\E.bar") # expected: foEo|.bar
split_at_first_delim("\\", "foo\\bar") # expected: foo|bar
split_at_first_delim("\\\\E", "foo\\\\Ebar") # expected: foo|barWe could fix this, or, simply detect |
jcheng5
reviewed
Apr 2, 2021
jcheng5
reviewed
Apr 2, 2021
jcheng5
previously approved these changes
Apr 5, 2021
jcheng5
previously approved these changes
Apr 5, 2021
jcheng5
approved these changes
Apr 5, 2021
rich-iannone
added a commit
that referenced
this pull request
Apr 5, 2021
* master: Add row group `id` as an argument to `tab_row_group()` (#699)
rich-iannone
added a commit
that referenced
this pull request
Apr 5, 2021
* master: Add row group `id` as an argument to `tab_row_group()` (#699)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR seeks to do what #665 did recently, which is to require and use IDs for different row groups. The function signature for
tab_row_group()will be similar to that of the analogoustab_spanner():This is not the only way to specify row groups in a gt table. Here is a breakdown of the three different ways to include them:
gt(); group labels are composed by the group column names being pasted together, each separated by_groupname_colarg ingt(); we can only choose one column so flexibility in grouping is purposefully limited compared to method (1)tab_row_groupfunction. This is used past the initialgt()step.Aside from introducing IDs here, this PR aims to fix a number of known bugs along the way.
Fixes: #671
Fixes: #675
Fixes: #717