Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
f6c862b
not working yet, saving state
gmbecker Jun 16, 2026
c3a5bb1
Working POC, plenty of work still to do
gmbecker Jun 17, 2026
19e3cb5
POC working but only nested= NA
gmbecker Jun 18, 2026
c678449
missing split_rows_by rd
gmbecker Jun 18, 2026
b6b0e86
implement at_sibling API, some code reorg
gmbecker Jun 19, 2026
0376e10
not working yet, saving state
gmbecker Jun 16, 2026
a70ef41
Working POC, plenty of work still to do
gmbecker Jun 17, 2026
6804d2c
POC working but only nested= NA
gmbecker Jun 18, 2026
4623163
missing split_rows_by rd
gmbecker Jun 18, 2026
fe4c526
implement at_sibling API, some code reorg
gmbecker Jun 19, 2026
f3baa73
Merge remote-tracking branch 'origin/1095_intermediate_nesting' into …
gmbecker Jul 31, 2026
1624269
Merge remote-tracking branch 'origin/main' into 1095_intermediate_nes…
gmbecker Aug 7, 2026
2738e96
1095 intermediate nesting add tests + revert to roxygen 8.0.0 + fix (…
munoztd0 Aug 17, 2026
4c8aa55
Merge remote-tracking branch 'origin/1095_intermediate_nesting' into …
gmbecker Aug 17, 2026
0c5a093
mergee origin/1095_intermediate_netsting
gmbecker Aug 17, 2026
f96e34d
move dave's tests to new file, check if right roxygen
gmbecker Aug 17, 2026
ee17457
document at_sibling argument, roxygen version looks good
gmbecker Aug 17, 2026
6fda3d9
fix (ridiculously) compex nesting case. add more tests
gmbecker Aug 17, 2026
16870c0
Merge branch 'main' into 1095_intermediate_nesting
munoztd0 Aug 18, 2026
4c280fe
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Aug 24, 2026
11034c7
revert
munoztd0 Aug 24, 2026
568d0c1
to use path_count/ tt_normalize_row_path instead.
munoztd0 Aug 24, 2026
2f29b6d
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 24, 2026
fbd5f05
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Aug 24, 2026
0010009
fix typo
munoztd0 Aug 24, 2026
9ad87c6
Merge branch '1095_intermediate_nesting' of https://github.com/pharma…
munoztd0 Aug 24, 2026
0ecf34c
lints and remove :::first_spl_name
munoztd0 Aug 24, 2026
4365cf9
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 24, 2026
05f7cea
Merge branch 'main' into 1095_intermediate_nesting
shajoezhu Aug 25, 2026
861daba
Merge branch 'main' into 1095_intermediate_nesting
shajoezhu Aug 25, 2026
d9df5c3
fix: correct R indentation for lintr
Copilot Aug 25, 2026
dcf242d
fix: satisfy lintr indentation rules
Copilot Aug 25, 2026
69cd184
[skip style] [skip vbump] Restyle files
github-actions[bot] Aug 25, 2026
b15ba75
lints
munoztd0 Aug 25, 2026
50e0c62
Merge branch '1095_intermediate_nesting' of https://github.com/pharma…
munoztd0 Aug 25, 2026
7814d28
Update News.md
munoztd0 Aug 25, 2026
13be610
fix typo charactere(1)
munoztd0 Aug 31, 2026
be58071
Fix SplitVectorTree label position accessor missing
munoztd0 Aug 31, 2026
d0639ab
clean old commented code
munoztd0 Aug 31, 2026
5408ee6
fix typo: maintainer
munoztd0 Aug 31, 2026
a77cbcb
Added a root-level page_by = TRUE guard before
munoztd0 Aug 31, 2026
d4e652e
comment cleanup
gmbecker Sep 9, 2026
9b87f1c
Merge remote-tracking branch 'origin/1095_intermediate_nesting' into …
gmbecker Sep 9, 2026
5ced716
Update API, documentation for int. nesting
gmbecker Sep 11, 2026
a6ed9d2
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Sep 14, 2026
794af76
additional tests, export get_anchors_list
gmbecker Sep 14, 2026
ea638e0
Merge remote-tracking branch 'origin/1095_intermediate_nesting' into …
gmbecker Sep 14, 2026
f75e0e6
[skip style] [skip vbump] Restyle files
github-actions[bot] Sep 14, 2026
65666ef
nesting vignette done, more tests, algorithm refinement
gmbecker Sep 16, 2026
5979f76
update pkgdown
gmbecker Sep 16, 2026
c3a242c
[skip style] [skip vbump] Restyle files
github-actions[bot] Sep 16, 2026
2d0b70e
Apply suggestion from @munoztd0
munoztd0 Sep 17, 2026
9263e84
fix typos in docs
munoztd0 Sep 17, 2026
e07e755
[skip roxygen] [skip vbump] Roxygen Man Pages Auto Update
github-actions[bot] Sep 17, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ Collate:
'argument_conventions.R'
'as_html.R'
'utils.R'
'nesting_impl.R'
'colby_constructors.R'
'compare_rtables.R'
'format_rcell.R'
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export(export_as_txt)
export(facet_colcount)
export(find_degen_struct)
export(format_rcell)
export(get_anchor_list)
export(get_formatted_cells)
export(has_force_pag)
export(head)
Expand Down Expand Up @@ -269,6 +270,7 @@ exportMethods(coltree)
exportMethods(content_table)
exportMethods(dim)
exportMethods(facet_colcount)
exportMethods(get_anchor_list)
exportMethods(has_force_pag)
exportMethods(head)
exportMethods(horizontal_sep)
Expand Down
6 changes: 5 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,13 @@
* Added vignette: Guided Tour (Advanced) - (stub) `TableTree` Objects - (stub) Accessing Table Values @gmbecker
* Added vignette: Guided Tour (Advanced) - (stub) `TableTree` Objects - (stub) Custom Scoring Functions For Sorting @gmbecker
* Added vignette: Guided Tour (Advanced) - (stub) `TableTree` Objects - (stub) Custom Pruning Functions @gmbecker

* Added `at_sibling` parameter to `split_rows_by*` and `analyze` functions, enabling placement of a new layout directive as a direct sibling of a previously declared split or analysis @gmbecker
* Added `get_anchor_list()` function for inspecting the available sibling anchors in an existing layout @gmbecker
* `label_pos` now accepts `"default"` as a value, which resolves to `"visible"` when `at_sibling` is non-`NULL` and `"hidden"` otherwise @gmbecker

### Bug Fixes
* `indent_mod<-` `RowsVerticalSection` method now correctly recycles length 1 values @gmbecker
* Fixed `uniqify_child_names` emitting messages ending in a literal `FALSE` due to passing `call. = FALSE` to `message()`, which does not accept that argument @gmbecker

## rtables 0.6.15

Expand Down
38 changes: 31 additions & 7 deletions R/00tabletrees.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ check_ok_label <- function(lbl, multi_ok = FALSE) {
}

valid_lbl_pos <- c("default", "visible", "hidden", "topleft")
.labelkids_helper <- function(charval) {
.labelkids_helper <- function(charval, na_ok = TRUE) {
ret <- switch(charval,
"default" = NA,
"default" = if (na_ok) NA else FALSE,
"visible" = TRUE,
"hidden" = FALSE,
"topleft" = FALSE,
Expand Down Expand Up @@ -466,7 +466,7 @@ MultiVarSplit <- function(vars,
colcount_format = NULL) {
check_ok_label(split_label)
## no topleft allowed
label_pos <- match.arg(label_pos, label_pos_values[-3])
label_pos <- match.arg(label_pos, label_pos_values[-4])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This had to move from [-3] to [-4] because an element was prepended to label_pos_values. setdiff(label_pos_values, "topleft") would not need touching next time.

Same shape at lines 725 and 779, where c("default", label_pos_values) now carries a duplicate since "default" is in the vector. match.arg resolves it fine, I checked, it is just leftover scaffolding.

child_labels <- match.arg(child_labels)
if (length(vars) == 1 && grepl(":", vars)) {
vars <- strsplit(vars, ":")[[1]]
Expand Down Expand Up @@ -1656,8 +1656,7 @@ uniqify_child_names <- function(kidlst) {
paste(val_to_fix, " -> {", paste(c(val_to_fix, newnms), collapse = ", "), "}]\n"),
" To control table names use split_rows_by*(, parent_name =.) or ",
" analyze(., table_names = .) when analyzing a single variable, or ",
"analyze(., parent_name = .) when analyzing multiple variables in a single call.",
call. = FALSE
"analyze(., parent_name = .) when analyzing multiple variables in a single call."
)
names(kidlst)[inds] <- newnms
}
Expand Down Expand Up @@ -1914,6 +1913,10 @@ TableTree <- function(kids = list(),
## a pre-existing TableTree/ElementaryTable.
## This is used for add_existing_table in colby_constructors.R

split_or_splitvectree <- function(object) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

head(object, -1) means a SplitVectorTree now validates at any position, but the implementation assumes trees are terminal, branch_above_split() has stopifnot(is(splvec[[svlen]], "SplitVectorTree")) on exactly that. Restricting the relaxation to the last element would keep the validity function saying what the code relies on.

is(object, "Split") || is(object, "SplitVectorTree")
}

setClass("SplitVector",
contains = "list",
validity = function(object) {
Expand All @@ -1922,8 +1925,8 @@ setClass("SplitVector",
} else {
lst <- NULL
}
all(sapply(head(object, -1), is, "Split")) &&
(is.null(lst) || is(lst, "Split") || is(lst, "VTableNodeInfo"))
all(sapply(head(object, -1), split_or_splitvectree)) &&
(is.null(lst) || split_or_splitvectree(lst) || is(lst, "VTableNodeInfo"))
}
)

Expand All @@ -1936,7 +1939,28 @@ SplitVector <- function(x = NULL,
new("SplitVector", lst)
}

setClass("SplitVectorTree",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

vars_in_layout() is exported and errors on anything built with at_sibling:

vars_in_layout(lyt)
#> unable to find an inherited method for function 'vars_in_layout' for signature 'lyt = "SplitVectorTree"'

I swept every generic carrying a SplitVector method against the tree methods added here. The ones without a counterpart are vars_in_layout, cmpnd_last_rowsplit, show, .tl_indent_inner and c. cmpnd_last_rowsplit is the blocker above and show is the print comment below, so vars_in_layout and .tl_indent_inner are the remainder. c looks fine in practice since the class contains list.

Might be worth walking that list once deliberately rather than adding tree methods as they surface.

contains = "list",
validity = function(object) {
all(vapply(object, function(x) is(x, "SplitVector") || is(x, "SplitVectorTree"), TRUE))
}
)

SplitVectorTree <- function(x = NULL,
...,
lst = list(...)) {
if (is.null(x)) {
xlst <- NULL
} else {
xlst <- list(x)
}
new("SplitVectorTree", c(xlst, lst))
}

avar_noneorlast <- function(vec) {
if (is(vec, "SplitVectorTree")) {
return(all(sapply(vec, avar_noneorlast)))
}
if (!is(vec, "SplitVector")) {
return(FALSE)
}
Expand Down
7 changes: 6 additions & 1 deletion R/argument_conventions.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ gen_args <- function(df, alt_counts_df, spl, pos, tt, tr, verbose, colwidths, ob
#' to the *split* or *group of sibling analyses*, for `split_rows_by*` and
#' `analyze*` when analyzing more than one variable, respectively. Ignored when
#' analyzing a single variable.
#' @param at_sibling (`character(1)` or `NULL`)\cr If non-null, a preceding
Comment thread
munoztd0 marked this conversation as resolved.
#' split or analyze to anchor this instruction to as a direct sibling. Cannot
#' select an instruction that is downstream of a point where a previously used
#' anchor (See Nesting Anchor Resolution for details).
#'
#' @inherit gen_args return
#'
Expand All @@ -165,7 +169,8 @@ lyt_args <- function(lyt, var, vars, label, labels_var, varlabels, varnames, spl
var_labels, cvar,
table_names, topleft, align, page_by, page_prefix,
format_na_str, section_div, na_str, show_colcounts,
colcount_format, parent_name, formats_var, na_strs_var) {
colcount_format, parent_name, formats_var, na_strs_var,
at_sibling) {
NULL
}

Expand Down
Loading
Loading