Context
PR #372 replaced gt with lt for summary tables. To work with the current CRAN lt (0.4), R/lt.R had to work around two lt limitations:
- No pattern-based column selection — spanner/label columns are enumerated with
grep("_time$", names(x), value = TRUE) etc.
- Spanner columns had to be listed in visual (post-
lt_move) order — lt matched a spanner to the visual position of its first column and spanned the next length(columns) cells, so a mismatched order silently dropped later spanners (this caused the "Probability of crossing efficacy bounds under H1" spanner to go missing; fixed in 76a63ca by listing columns in explicit asy-before-sim order).
Both limitations are addressed in the next lt version (merged upstream in yihui/lt#5 plus follow-up yihui/lt@50c09bc):
- Predicate formulas:
columns = ~ endsWith(., "_time"), ~ grepl("_prob$", .), ~ . (all columns), etc.
lt_label() accepts a single named list/vector of labels (no more do.call() splice).
- Spanner columns auto-reordered to body order at render, so their listed order no longer matters (predicate selectors are safe for spanners too).
Task (do this once lt >= that version is on CRAN)
In R/lt.R:
In vignettes/discrepancy-between-simtrial-and-survival.Rmd:
In DESCRIPTION:
References
Context
PR #372 replaced gt with lt for summary tables. To work with the current CRAN lt (0.4),
R/lt.Rhad to work around two lt limitations:grep("_time$", names(x), value = TRUE)etc.lt_move) order — lt matched a spanner to the visual position of its first column and spanned the nextlength(columns)cells, so a mismatched order silently dropped later spanners (this caused the "Probability of crossing efficacy bounds under H1" spanner to go missing; fixed in 76a63ca by listing columns in explicit asy-before-sim order).Both limitations are addressed in the next lt version (merged upstream in yihui/lt#5 plus follow-up yihui/lt@50c09bc):
columns = ~ endsWith(., "_time"),~ grepl("_prob$", .),~ .(all columns), etc.lt_label()accepts a single named list/vector of labels (no moredo.call()splice).Task (do this once lt >= that version is on CRAN)
In
R/lt.R:grep(..., names(x), value = TRUE)spanner enumerations (and the explicitc("asy_time", "sim_time")ordering added in 76a63ca) with predicate selectors, e.g.lt_spanner(Time ~ endsWith(., "_time")). Spanner auto-reorder means order no longer needs hand-managing.do.call(lt::lt_label, c(list(ans), labels))splice withans |> lt::lt_label(labels)(single named vector). See the review suggestion on PR Replace gt with lt for summary tables (#371) #372.In
vignettes/discrepancy-between-simtrial-and-survival.Rmd:lt_format(columns = names(fr)[sapply(fr, is.numeric)], ...)with theeverything()equivalentcolumns = ~ ..In
DESCRIPTION:ltImports version constraint to the release that ships these features (lt (>= X.Y.Z)).References