Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades committed Apr 9, 2024
1 parent 98e686e commit 44c1fd5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@
* Fixed edge case bug in `as_result_df` where rows of the table have only `"root"` as path index.
* Fixed `sort_at_path` pathing to ignore leading `"root"` element (regardless of actual root element name) to match current `tt_at_path` behavior.
* Fixed `section_div` for analysis of multiple variables (`AnalyzeMultiVars`).
* Fixed mismatch between indentation declared in row info (`mf_rinfo(mf)`) and actual selected indentation from `matrix_form(mf, indent_rownames = FALSE)`.

### Miscellaneous
* Removed deprecated functions `add_analyzed_var` and `trim_zero_rows`.
* Removed deprecated functions `add_analyzed_var` and `trim_zero_rows`.

## rtables 0.6.6
### New Features
Expand Down
3 changes: 3 additions & 0 deletions R/tt_toString.R
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,12 @@ setMethod(
body[, 1] <- indent_string(body[, 1], c(rep(0, nr_header), sr$indent),
incr = indent_size
)
# why also formats?
formats[, 1] <- indent_string(formats[, 1], c(rep(0, nr_header), sr$indent),
incr = indent_size
)
} else {
sr$indent <- rep(0, NROW(sr))
}

col_ref_strs <- matrix(vapply(header_content$footnotes, function(x) {
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-matrix_form.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
context("matrix_form works")

test_that("matrix_form works with indent_rownames = FALSE", {
# Discovered thanks to more stringent indentation checks. See #844 for when it
# surfaced. Cause: make_row_df does not update mf_rinfo indentation if indent_rownames = FALSE
lyt <- basic_table() %>% split_rows_by("ARM") %>% analyze("AGE")
tbl <- build_table(lyt, ex_adsl)
mf <- matrix_form(tbl, indent_rownames = FALSE)
expect_equal(mf_rinfo(mf)$indent, rep(0, nrow(tbl)))
expect_silent(out <- toString(mf))
})

Check warning on line 11 in tests/testthat/test-matrix_form.R

View workflow job for this annotation

GitHub Actions / SuperLinter 🦸‍♀️ / Lint R code 🧶

file=tests/testthat/test-matrix_form.R,line=11,col=3,[trailing_blank_lines_linter] Missing terminal newline.

0 comments on commit 44c1fd5

Please sign in to comment.