Skip to content

Commit

Permalink
Merge branch 'main' into adding_stats_names_to_ards@main
Browse files Browse the repository at this point in the history
  • Loading branch information
Melkiades authored Nov 27, 2024
2 parents ed3c2e2 + 1514d7c commit 642f0a7
Show file tree
Hide file tree
Showing 7 changed files with 39 additions and 10 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
secrets:
REPO_GITHUB_TOKEN: ${{ secrets.REPO_GITHUB_TOKEN }}
with:
sd-direction: upstream
deps-installation-method: setup-r-dependencies
lookup-refs: |
insightsengineering/formatters
default-landing-page: latest-tag
additional-unit-test-report-directories: unit-test-report-non-cran
6 changes: 6 additions & 0 deletions .revdeprefs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- insightsengineering/tern
- insightsengineering/tern.gee
- insightsengineering/tern.mmrm
- insightsengineering/tern.rbmi
- insightsengineering/scda.test

6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rtables
Title: Reporting Tables
Version: 0.6.10.9005
Date: 2024-11-20
Version: 0.6.10.9007
Date: 2024-11-27
Authors@R: c(
person("Gabriel", "Becker", , "[email protected]", role = "aut",
comment = "Original creator of the package"),
Expand Down Expand Up @@ -29,7 +29,7 @@ URL: https://github.com/insightsengineering/rtables,
https://insightsengineering.github.io/rtables/
BugReports: https://github.com/insightsengineering/rtables/issues
Depends:
formatters (>= 0.5.9),
formatters (>= 0.5.9.9004),
magrittr (>= 1.5),
methods,
R (>= 2.10)
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## rtables 0.6.10.9005
## rtables 0.6.10.9007

### New Features
* Experimental pagination is now possible in `tt_as_flextable()` and `export_as_docx()`.
Expand All @@ -15,6 +15,8 @@

### Bug Fixes
* Fixed bug that was keeping indentation space characters in top left information when making a `flextable` from a `TableTree` object.
* Fixed bug in `analyze` that was causing an error when passing a single `NA` value to the
`var_labels` parameter.

## rtables 0.6.10

Expand Down
4 changes: 4 additions & 0 deletions R/colby_constructors.R
Original file line number Diff line number Diff line change
Expand Up @@ -1113,6 +1113,10 @@ analyze <- function(lyt,
section_div = NA_character_) {
show_labels <- match.arg(show_labels)
subafun <- substitute(afun)
# R treats a single NA value as a logical atomic. The below
# maps all the NAs in `var_labels` to NA_character_ required by `Split`
# and avoids the error when `var_labels` is just c(NA).
var_labels <- vapply(var_labels, function(label) ifelse(is.na(label), NA_character_, label), character(1))
if (
is.name(subafun) &&
is.function(afun) &&
Expand Down
7 changes: 7 additions & 0 deletions tests/testthat/test-colby_constructors.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
test_that("analyze's var_labels accepts a vector of length 1 consisting of a single NA", {
testthat::expect_no_error(
basic_table() %>%
split_cols_by("ARM") %>%
analyze("AGE", var_labels = c(AGE = NA))
)
})
18 changes: 13 additions & 5 deletions tests/testthat/test-printing.R
Original file line number Diff line number Diff line change
Expand Up @@ -656,17 +656,25 @@ test_that("row label indentation is kept even if there are newline characters",

test_that("Support for newline characters in all the parts", {
out <- strsplit(toString(tt_for_nl, hsep = "-"), "\\n")[[1]]
mf <- matrix_form(tt_for_nl, TRUE)

# topleft is correctly aligned
expect_equal(
mf$strings[seq(mf_nlheader(mf)), 1],
unlist(strsplit(paste0(top_left(tt_for_nl), collapse = "\n"), "\n"))
)

expected <- c(
"why not",
"also here",
"",
"---------------------------------",
" ",
" ARM ",
" ",
"a A ",
"b A wo",
"d TWO ",
"a ARM ",
"b ",
"d A ",
" A wo",
" TWO ",
"c words rd ",
"---------------------------------",
"m ",
Expand Down

0 comments on commit 642f0a7

Please sign in to comment.