-
Notifications
You must be signed in to change notification settings - Fork 53
1095 intermediate nesting #1111
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
base: main
Are you sure you want to change the base?
Changes from all commits
f6c862b
c3a5bb1
19e3cb5
c678449
b6b0e86
0376e10
a70ef41
6804d2c
4623163
fe4c526
f3baa73
1624269
2738e96
4c8aa55
0c5a093
f96e34d
ee17457
6fda3d9
16870c0
4c280fe
11034c7
568d0c1
2f29b6d
fbd5f05
0010009
9ad87c6
0ecf34c
4365cf9
05f7cea
861daba
d9df5c3
dcf242d
69cd184
b15ba75
50e0c62
7814d28
13be610
be58071
d0639ab
5408ee6
a77cbcb
d4e652e
9b87f1c
5ced716
a6ed9d2
794af76
ea638e0
f75e0e6
65666ef
5979f76
c3a242c
2d0b70e
9263e84
e07e755
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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, | ||
|
|
@@ -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]) | ||
| child_labels <- match.arg(child_labels) | ||
| if (length(vars) == 1 && grepl(":", vars)) { | ||
| vars <- strsplit(vars, ":")[[1]] | ||
|
|
@@ -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 | ||
| } | ||
|
|
@@ -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) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| is(object, "Split") || is(object, "SplitVectorTree") | ||
| } | ||
|
|
||
| setClass("SplitVector", | ||
| contains = "list", | ||
| validity = function(object) { | ||
|
|
@@ -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")) | ||
| } | ||
| ) | ||
|
|
||
|
|
@@ -1936,7 +1939,28 @@ SplitVector <- function(x = NULL, | |
| new("SplitVector", lst) | ||
| } | ||
|
|
||
| setClass("SplitVectorTree", | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
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 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) | ||
| } | ||
|
|
||
There was a problem hiding this comment.
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 tolabel_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.argresolves it fine, I checked, it is just leftover scaffolding.