Skip to content
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

Fixes after refactor of string wrapping #1080

Merged
merged 5 commits into from
Oct 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion R/summarize_coxreg.R
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,8 @@ summarize_coxreg <- function(lyt,
lyt <- lyt %>%
analyze_colvars(
afun = a_coxreg,
extra_args = list(variables = variables, at = at, control = control, multivar = multivar, labelstr = "")
extra_args = list(variables = variables, at = at, control = control, multivar = multivar, labelstr = ""),
indent_mod = if (!"arm" %in% names(variables) || multivar) 0L else -1L
)
}
}
Expand Down
4 changes: 3 additions & 1 deletion R/summarize_num_patients.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ s_num_patients <- function(x, labelstr, .N_col, count_by = NULL, unique_count_su
out <- list(
unique = formatters::with_label(c(count1, ifelse(count1 == 0 && .N_col == 0, 0, count1 / .N_col)), labelstr),
nonunique = formatters::with_label(count2, labelstr),
unique_count = formatters::with_label(count1, ifelse(unique_count_suffix, paste(labelstr, "(n)"), labelstr))
unique_count = formatters::with_label(
count1, ifelse(unique_count_suffix, paste0(labelstr, if (nzchar(labelstr)) " ", "(n)"), labelstr)
)
)

out
Expand Down
34 changes: 17 additions & 17 deletions tests/testthat/_snaps/summarize_num_patients.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$unique_count
[1] 3
attr(,"label")
[1] " (n)"
[1] "(n)"


# s_num_patients works as expected with empty input
Expand All @@ -37,7 +37,7 @@
$unique_count
[1] 0
attr(,"label")
[1] " (n)"
[1] "(n)"


# s_num_patients works as expected with unique_count_suffix = FALSE
Expand Down Expand Up @@ -79,7 +79,7 @@
$unique_count
[1] 3
attr(,"label")
[1] " (n)"
[1] "(n)"


# summarize_num_patients works as expected with healthy input
Expand Down Expand Up @@ -119,10 +119,10 @@
Code
res
Output
A B
(N=5) (N=4)
———————————————————
(n) 3 3
A B
(N=5) (N=4)
———————————————————
(n) 3 3

# s_num_patients count_by works as expected with healthy input

Expand All @@ -142,7 +142,7 @@
$unique_count
[1] 3
attr(,"label")
[1] " (n)"
[1] "(n)"


# s_num_patients count_by with missing works as expected with healthy input
Expand All @@ -163,7 +163,7 @@
$unique_count
[1] 3
attr(,"label")
[1] " (n)"
[1] "(n)"


# s_num_patients count_by with missing case 2 works as expected with healthy input
Expand All @@ -184,7 +184,7 @@
$unique_count
[1] 3
attr(,"label")
[1] " (n)"
[1] "(n)"


# s_num_patients_content with count_by works as expected with healthy input
Expand All @@ -205,7 +205,7 @@
$unique_count
[1] 3
attr(,"label")
[1] " (n)"
[1] "(n)"


# s_num_patients_content with count_by case 2 works as expected with healthy input
Expand All @@ -226,7 +226,7 @@
$unique_count
[1] 3
attr(,"label")
[1] " (n)"
[1] "(n)"


# s_num_patients_content with count_by trivial cases, identical to without count_by
Expand All @@ -247,7 +247,7 @@
$unique_count
[1] 4
attr(,"label")
[1] " (n)"
[1] "(n)"


# summarize_num_patients with count_by works as expected with healthy input
Expand Down Expand Up @@ -287,10 +287,10 @@
Code
res
Output
A B
(N=5) (N=4)
———————————————————
(n) 3 3
A B
(N=5) (N=4)
———————————————————
(n) 3 3

# summarize_num_patients with count_by different combinations works as expected with healthy input

Expand Down