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

Fix tests using ADPC after refactor #60

Merged
merged 2 commits into from
Jul 18, 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
98 changes: 55 additions & 43 deletions tests/testthat/_snaps/listing_adal02.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# ADAL02 listing is produced correctly

Check notice on line 1 in tests/testthat/_snaps/listing_adal02.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/listing_adal02.md#L1

"correctly" can weaken meaning

Code
result
Expand All @@ -8,51 +8,63 @@

Treatment Group: A: Drug X

——————————————————————————————————————————————————————
Day 2 Patient Treatment
Subject ID (Day 1) Emergent ADA Status
——————————————————————————————————————————————————————
AB12345-BRA-1-id-93 <1.10* Induced (Persistent)
AB12345-CHN-1-id-123 1.28* Induced (Persistent)
AB12345-CHN-1-id-329 1.43* Induced (Persistent)
AB12345-CHN-1-id-53 <1.10* Induced (Persistent)
AB12345-CHN-1-id-71 1.28* Induced (Persistent)
AB12345-CHN-11-id-116 1.36* Induced (Persistent)
AB12345-CHN-11-id-124 <1.10* Induced (Persistent)
AB12345-CHN-11-id-167 1.26* Induced (Persistent)
AB12345-CHN-11-id-256 1.35* Induced (Persistent)
AB12345-CHN-11-id-377 1.17* Induced (Persistent)
AB12345-CHN-12-id-258 1.40* Induced (Persistent)
AB12345-CHN-12-id-266 <1.10* Induced (Persistent)
AB12345-CHN-12-id-57 1.24* Induced (Persistent)
AB12345-CHN-14-id-161 <1.10* Induced (Persistent)
AB12345-CHN-15-id-399 <1.10* Induced (Persistent)
AB12345-CHN-18-id-170 <1.10* Induced (Persistent)
AB12345-CHN-2-id-22 <1.10* Induced (Persistent)
AB12345-CHN-2-id-272 1.20* Induced (Persistent)
AB12345-CHN-2-id-398 1.14* Induced (Persistent)
AB12345-CHN-3-id-128 1.21* Induced (Persistent)
AB12345-CHN-3-id-361 1.32* Induced (Persistent)
AB12345-CHN-5-id-108 <1.10* Induced (Persistent)
AB12345-CHN-8-id-205 1.14* Induced (Persistent)
AB12345-GBR-13-id-80 <1.10* Induced (Persistent)
AB12345-GBR-15-id-293 1.14* Induced (Persistent)
AB12345-JPN-1-id-218 <1.10* Induced (Persistent)
AB12345-NGA-1-id-388 <1.10* Induced (Persistent)
AB12345-NGA-2-id-353 <1.10* Induced (Persistent)
AB12345-PAK-1-id-79 1.26* Induced (Persistent)
AB12345-PAK-11-id-187 1.16* Induced (Persistent)
AB12345-PAK-13-id-251 1.14* Induced (Persistent)
AB12345-PAK-15-id-314 <1.10* Induced (Persistent)
AB12345-RUS-1-id-52 1.22* Induced (Persistent)
AB12345-RUS-6-id-77 1.16* Induced (Persistent)
AB12345-USA-11-id-238 1.31* Induced (Persistent)
AB12345-USA-11-id-339 1.24* Induced (Persistent)
AB12345-USA-17-id-142 1.35* Induced (Persistent)
AB12345-USA-3-id-282 <1.10* Induced (Persistent)
——————————————————————————————————————————————————————
—————————————————————————————————————————————————————
Day 2 Patient Treatment
Subject ID (Day 1) Emergent ADA Status
—————————————————————————————————————————————————————
AB12345-BRA-1-id-105 --- Enhanced
AB12345-BRA-1-id-134 --- Enhanced
AB12345-BRA-1-id-42 --- Enhanced
AB12345-BRA-1-id-93 --- Enhanced
AB12345-BRA-11-id-217 --- Enhanced
AB12345-BRA-11-id-345 --- Enhanced
AB12345-BRA-11-id-397 --- Enhanced
AB12345-BRA-11-id-50 --- Enhanced
AB12345-BRA-13-id-177 --- Enhanced
AB12345-BRA-14-id-23 --- Enhanced
AB12345-BRA-15-id-36 --- Enhanced
AB12345-BRA-2-id-296 --- Enhanced
AB12345-BRA-6-id-369 --- Enhanced
AB12345-CAN-1-id-18 --- Enhanced
AB12345-CAN-11-id-139 --- Enhanced
AB12345-CAN-14-id-104 --- Enhanced
AB12345-CHN-1-id-119 --- Enhanced
AB12345-CHN-1-id-123 --- Enhanced
AB12345-CHN-1-id-133 --- Enhanced
AB12345-CHN-1-id-199 --- Enhanced
AB12345-CHN-1-id-216 --- Enhanced
AB12345-CHN-1-id-235 --- Enhanced
AB12345-CHN-1-id-25 --- Enhanced
AB12345-CHN-1-id-26 --- Enhanced
AB12345-CHN-1-id-275 --- Enhanced
AB12345-CHN-1-id-277 --- Enhanced
AB12345-CHN-1-id-287 --- Enhanced
AB12345-CHN-1-id-315 --- Enhanced
AB12345-CHN-1-id-316 --- Enhanced
AB12345-CHN-1-id-329 --- Enhanced
AB12345-CHN-1-id-360 --- Enhanced
AB12345-CHN-1-id-371 --- Enhanced
AB12345-CHN-1-id-47 --- Enhanced
AB12345-CHN-1-id-53 --- Enhanced
AB12345-CHN-1-id-62 --- Enhanced
AB12345-CHN-1-id-69 --- Enhanced
AB12345-CHN-1-id-71 --- Enhanced
AB12345-CHN-11-id-116 --- Enhanced
AB12345-CHN-11-id-124 --- Enhanced
AB12345-CHN-11-id-132 --- Enhanced
AB12345-CHN-11-id-153 --- Enhanced
AB12345-CHN-11-id-167 --- Enhanced
AB12345-CHN-11-id-256 --- Enhanced
AB12345-CHN-11-id-354 --- Enhanced
AB12345-CHN-11-id-356 --- Enhanced
AB12345-CHN-11-id-377 --- Enhanced
AB12345-CHN-11-id-379 --- Enhanced
AB12345-CHN-11-id-392 --- Enhanced
AB12345-CHN-11-id-88 --- Enhanced
AB12345-CHN-12-id-258 --- Enhanced
—————————————————————————————————————————————————————

Minimum reportable titer = 1.10 (example only)

Check notice on line 67 in tests/testthat/_snaps/listing_adal02.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/listing_adal02.md#L67

"Minimum" is wordy or unneeded

Check notice on line 67 in tests/testthat/_snaps/listing_adal02.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/listing_adal02.md#L67

"only" can weaken meaning
--- = No sample evaluated
ADA = Anti-Drug Antibodies (is also referred to as ATA, or Anti-Therapeutic Antibodies)
Number of patients positive for Treatment Emergent ADA = the number of post-baseline evaluable patients determined to
Expand All @@ -60,11 +72,11 @@
negative or missing baseline ADA result(s) and at least one positive post-baseline ADA result.
Treatment-enhanced ADA = a patient with positive ADA result at baseline who has one or more post-baseline titer
results that are at least 0.60 t.u. greater than the baseline titer result.
Transient ADA = ADA positive result detected (a) at only one post-baseline sampling timepoint (excluding last

Check notice on line 75 in tests/testthat/_snaps/listing_adal02.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/listing_adal02.md#L75

"only" can weaken meaning
timepoint) OR (b) at 2 or more timepoints during treatment where the first and last ADA positive samples are
separated by a period of < 16 weeks, irrespective of any negative samples in between.

Check notice on line 77 in tests/testthat/_snaps/listing_adal02.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/listing_adal02.md#L77

"in between" is wordy or unneeded
Persistent ADA = ADA positive result detected (a) at the last post-baseline sampling timepoint, OR (b) at 2 or more
time points during treatment where the first and last ADA positive samples are separated by a period ≥ 16 weeks,
irrespective of any negative samples in between.

Check notice on line 80 in tests/testthat/_snaps/listing_adal02.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/listing_adal02.md#L80

"in between" is wordy or unneeded
Asterisk denotes sample that tested positive for Neutralizing Antibodies.

28 changes: 14 additions & 14 deletions tests/testthat/_snaps/table_adat03.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
# ADAT03 is produced correctly

Check notice on line 1 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L1

"correctly" can weaken meaning

Code
res
Output
Treatment Group
Visit Total Number Samples with
of Measurable Concentration
Samples {1} Mean SD Median Minimum Maximum CV (%) Geometric Mean ≤ 15μg/mL {2}
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
A: Drug X (N=670)
Day 1 536 3.152e+00 5.516e+00 0.000e+00 0.000e+00 1.557e+01 175.0 NA 531 (99.1%)
Day 2 134 1.618e+01 1.626e+00 1.619e+01 1.260e+01 1.986e+01 10.0 1.610e+01 39 (29.1%)
Treatment Group
Visit Total Number Samples with
of Measurable Concentration
Samples {1} Mean SD Median Minimum Maximum CV (%) Geometric Mean ≤ 15μg/mL {2}

Check notice on line 9 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L9

"Minimum" is wordy or unneeded

Check notice on line 9 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L9

"Maximum" is wordy or unneeded
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
A: Drug X (N=536)
Day 1 402 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 NA NA 402 (100%)

Check notice on line 12 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L12

"0.000e+00" is repeated

Check notice on line 12 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L12

"0.000e+00" is repeated

Check notice on line 12 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L12

"0.000e+00" is repeated

Check notice on line 12 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L12

"0.000e+00" is repeated

Check notice on line 12 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L12

"NA" is repeated
Day 2 134 1.618e+01 1.626e+00 1.619e+01 1.260e+01 1.986e+01 10.0 1.610e+01 39 (29.1%)

C: Combination (N=1056)
Day 1 792 6.459e+00 9.961e+00 0.000e+00 0.000e+00 3.100e+01 154.2 NA 654 (82.6%)
Day 2 264 2.468e+01 8.645e+00 2.251e+01 1.264e+01 3.947e+01 35.0 2.315e+01 28 (10.6%)
C: Combination (N=792)
Day 1 528 0.000e+00 0.000e+00 0.000e+00 0.000e+00 0.000e+00 NA NA 528 (100%)

Check notice on line 16 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L16

"0.000e+00" is repeated

Check notice on line 16 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L16

"0.000e+00" is repeated

Check notice on line 16 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L16

"0.000e+00" is repeated

Check notice on line 16 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L16

"0.000e+00" is repeated

Check notice on line 16 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L16

"NA" is repeated
Day 2 264 2.468e+01 8.645e+00 2.251e+01 1.264e+01 3.947e+01 35.0 2.315e+01 28 (10.6%)

Overall 1726 8.975e+00 1.104e+01 0.000e+00 0.000e+00 3.947e+01 123.0 NA 1252 (72.5%)
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
Overall 1328 6.540e+00 1.095e+01 0.000e+00 0.000e+00 3.947e+01 167.5 NA 997 (75.1%)

Check notice on line 19 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L19

"Overall" is wordy or unneeded

Check notice on line 19 in tests/testthat/_snaps/table_adat03.md

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/_snaps/table_adat03.md#L19

"0.000e+00" is repeated
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————

{1} - footnote1
{2} - footnote2
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————


41 changes: 25 additions & 16 deletions tests/testthat/test-listing_adal02.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
testthat::test_that("ADAL02 listing is produced correctly", {

Check notice on line 1 in tests/testthat/test-listing_adal02.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-listing_adal02.R#L1

"correctly" can weaken meaning
adab <- adab_raw %>%
filter(NRELTM1 %% 1 == 0 & NRELTM1 > 0)
filter(NFRLT %% 1 == 0 & NFRLT > 0)

trt <- "A: Drug X"
drug_a <- "A: Drug X Antibody"
Expand All @@ -11,29 +11,30 @@
filter(
ARM == trt,
PARCAT1 == drug_a,
ADAPBLFL == "Y"
ADPBLPFL == "Y"
) %>%
select(-PARAMCD, -AVALC, -AVALU, -ARELTM2, -NRELTM2) %>%
select(-PARAMCD, -AVALC, -AVALU, -ARRLT, -NRRLT) %>%
unique() %>%
tidyr::pivot_wider(
names_from = PARAM,
values_from = AVAL
) %>%
filter(`Treatment Emergent - Positive` == 1) %>%
filter(if_any(matches("Treatment Emergent - Positive"), ~ .x == 1)) %>%
# filter(`Treatment Emergent - Positive` == 1) %>%
mutate(
VISN = factor(paste0(
VISIT, "\n(Day ",
ifelse(
NRELTM1 %% 1 == 0,
NRELTM1,
as.character(format(round(NRELTM1, 2), nsmall = 2))
NFRLT %% 1 == 0,
NFRLT,
as.character(format(round(NFRLT, 2), nsmall = 2))
),
")"
)),
PTES = ifelse(
`Treatment induced ADA` == 1,
ifelse("Treatment induced ADA" %in% names(.), `Treatment induced ADA` == 1, FALSE),
ifelse(
`Transient ADA` == 1,
"Transient ADA" %in% names(.) & `Transient ADA` == 1,
"Induced (Transient)",
"Induced (Persistent)"
),
Expand All @@ -42,16 +43,24 @@
) %>%
mutate(
AVAL = paste0(
ifelse(`ADA interpreted per sample result` == 0,
ifelse(
ifelse("ADA interpreted per sample result" %in% names(.), `ADA interpreted per sample result` == 0, FALSE),
"NEGATIVE",
ifelse(is.na(`Antibody titer units`),
"---",
ifelse(`Antibody titer units` < min_titer,
ifelse(
ifelse("Antibody titer units" %in% names(.), !is.na(`Antibody titer units`), FALSE),
ifelse(
`Antibody titer units` < min_titer,
paste0("<", format(min_titer, nsmall = 2)),
as.character(format(round(`Antibody titer units`, 2), nsmall = 2))
)
),
"---"
)
), ifelse(`NAB interpreted per sample result` == 1, "*", "")
),
ifelse(
ifelse("NAB interpreted per sample result" %in% names(.), `NAB interpreted per sample result` == 1, FALSE),
"*",
""
)
)
)

Expand All @@ -61,7 +70,7 @@
names_from = VISN,
values_from = AVAL
) %>%
select(USUBJID, unique(adab_x$VISN[order(adab_x$NRELTM1)]), PTES)
select(USUBJID, unique(adab_x$VISN[order(adab_x$NFRLT)]), PTES)

formatters::var_labels(out) <- names(out)

Expand All @@ -80,7 +89,7 @@
"\nProtocol: ", unique(adab$PARCAT1)[1]
),
subtitles = paste("\nTreatment Group:", trt),
main_footer = "Minimum reportable titer = 1.10 (example only)

Check notice on line 92 in tests/testthat/test-listing_adal02.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-listing_adal02.R#L92

"Minimum" is wordy or unneeded

Check notice on line 92 in tests/testthat/test-listing_adal02.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-listing_adal02.R#L92

"only" can weaken meaning
--- = No sample evaluated
ADA = Anti-Drug Antibodies (is also referred to as ATA, or Anti-Therapeutic Antibodies)
Number of patients positive for Treatment Emergent ADA = the number of post-baseline evaluable patients determined to
Expand All @@ -88,12 +97,12 @@
negative or missing baseline ADA result(s) and at least one positive post-baseline ADA result.
Treatment-enhanced ADA = a patient with positive ADA result at baseline who has one or more post-baseline titer
results that are at least 0.60 t.u. greater than the baseline titer result.
Transient ADA = ADA positive result detected (a) at only one post-baseline sampling timepoint (excluding last

Check notice on line 100 in tests/testthat/test-listing_adal02.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-listing_adal02.R#L100

"only" can weaken meaning
timepoint) OR (b) at 2 or more timepoints during treatment where the first and last ADA positive samples are
separated by a period of < 16 weeks, irrespective of any negative samples in between.

Check notice on line 102 in tests/testthat/test-listing_adal02.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-listing_adal02.R#L102

"in between" is wordy or unneeded
Persistent ADA = ADA positive result detected (a) at the last post-baseline sampling timepoint, OR (b) at 2 or more
time points during treatment where the first and last ADA positive samples are separated by a period ≥ 16 weeks,
irrespective of any negative samples in between.

Check notice on line 105 in tests/testthat/test-listing_adal02.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-listing_adal02.R#L105

"in between" is wordy or unneeded
Asterisk denotes sample that tested positive for Neutralizing Antibodies."
) %>% head(50), "sorting incoming data by key columns")

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-listing_pkcl01.R
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
testthat::test_that("PKCL01 listing is produced correctly", {

Check notice on line 1 in tests/testthat/test-listing_pkcl01.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-listing_pkcl01.R#L1

"correctly" can weaken meaning
adpc <- adpc_raw
analyte <- "Plasma Drug X"
out <- adpc %>%
filter(PARAM == analyte) %>%
select(ARM, USUBJID, VISIT, NRELTM1, ARELTM1, AVAL)
select(ARM, USUBJID, VISIT, NFRLT, AFRLT, AVAL)

formatters::var_labels(out) <- c(
ARM = "Treatment Group",
USUBJID = "Subject ID",
VISIT = "Visit",
NRELTM1 = paste0("Nominal Sampling\nTime (", adpc$RELTMU[1], ")"),
ARELTM1 = paste0("Actual Time\nFrom First\nDose (", adpc$RELTMU[1], ")"),
NFRLT = paste0("Nominal Sampling\nTime (", adpc$RELTMU[1], ")"),
AFRLT = paste0("Actual Time\nFrom First\nDose (", adpc$RELTMU[1], ")"),
AVAL = paste0("Concentration\n(", adpc$AVALU[1], ")")
)

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-table_adat03.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
adpc <- adpc_raw %>% select(USUBJID, NRELTM1, AVAL, AVALU, AVALC)
adpc <- adpc_raw %>% select(USUBJID, NFRLT, AVAL, AVALU)
anl <- adab_raw %>%
filter(., PARAM == "ADA interpreted per sample result") %>%
select(-AVAL, AVALC, AVALU)
select(-AVAL, AVALU)

anl <- merge(anl, adpc, by = c("USUBJID", "NRELTM1")) %>%
anl <- merge(anl, adpc, by = c("USUBJID", "NFRLT")) %>%
mutate(AVAL_LT = ifelse(AVAL <= 15, TRUE, FALSE))

# parameters in columns
Expand All @@ -13,8 +13,8 @@
mean = "Mean",
sd = "SD",
median = "Median",
min = "Minimum",

Check notice on line 16 in tests/testthat/test-table_adat03.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_adat03.R#L16

"Minimum" is wordy or unneeded
max = "Maximum",

Check notice on line 17 in tests/testthat/test-table_adat03.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_adat03.R#L17

"Maximum" is wordy or unneeded
cv = "CV (%)",
geom_mean = "Geometric Mean",
count_fraction = paste0("Samples with\nConcentration\n≤ 15μg/mL")
Expand All @@ -33,10 +33,10 @@

afun_list <- lapply(
1:9,
function(i) make_afun(s_summary, .stats = adat03_stats[i], .formats = adat03_fmts[i], .labels = "Overall")

Check notice on line 36 in tests/testthat/test-table_adat03.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_adat03.R#L36

"Overall" is wordy or unneeded
)

testthat::test_that("ADAT03 is produced correctly", {

Check notice on line 39 in tests/testthat/test-table_adat03.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_adat03.R#L39

"correctly" can weaken meaning
result <- basic_table() %>%
split_rows_by(
var = "ARM",
Expand All @@ -61,7 +61,7 @@
analyze_colvars(
afun_list,
nested = FALSE,
extra_args = list(".labels" = "Overall")

Check notice on line 64 in tests/testthat/test-table_adat03.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_adat03.R#L64

"Overall" is wordy or unneeded
) %>%
build_table(anl, alt_counts_df = adsl_raw)

Expand Down
14 changes: 7 additions & 7 deletions tests/testthat/test-table_pkct01.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
adpc <- adpc_raw

testthat::test_that("PKCT01 is produced correctly", {

Check notice on line 3 in tests/testthat/test-table_pkct01.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_pkct01.R#L3

"correctly" can weaken meaning
l <- basic_table() %>%
split_rows_by(
var = "ARM",
Expand All @@ -24,11 +24,11 @@
) %>%
split_rows_by(var = "PARAM", child_labels = "hidden") %>%
analyze_vars_in_cols(
vars = "AVALC", var_type = "character", .stats = c("n_blq"),
vars = "AVALCAT1", var_type = "character", .stats = c("n_blq"),
.labels = c(n_blq = "n_blq")
)

adpc <- adpc %>% mutate(AVALC = as.factor(AVALC))
adpc <- adpc %>% mutate(AVALCAT1 = as.factor(AVALCAT1))
result <- build_table(l2, df = adpc)

res <- testthat::expect_silent(result)
Expand All @@ -44,12 +44,12 @@
# Setting up the data
adpc_1 <- adpc %>%
mutate(
NRELTM1 = as.factor(NRELTM1),
AVALC = as.factor(AVALC)
NFRLT = as.factor(NFRLT),
AVALCAT1 = as.factor(AVALCAT1)
) %>%
filter(ACTARM %in% c("A: Drug X")) %>%
mutate(ACTARM = factor(ACTARM, levels = c("A: Drug X"))) %>%
select(NRELTM1, ACTARM, VISIT, AVAL, PARAM, AVALC)
select(NFRLT, ACTARM, VISIT, AVAL, PARAM, AVALCAT1)

# Row structure
l_rows <- basic_table() %>%
Expand All @@ -64,7 +64,7 @@
label_pos = "topleft"
) %>%
split_rows_by(
var = "NRELTM1",
var = "NFRLT",
split_label = "Norminal Time from First Dose",
label_pos = "topleft",
child_labels = "hidden"
Expand All @@ -73,7 +73,7 @@
# Column results for numeric values
lyt <- l_rows %>%
analyze_vars_in_cols(
vars = c("AVAL", "AVALC", rep("AVAL", 8)),
vars = c("AVAL", "AVALCAT1", rep("AVAL", 8)),
.stats = c(
"n", "n_blq", "mean", "sd", "cv",
"geom_mean", "geom_cv", # "geom_mean_ci",
Expand All @@ -100,8 +100,8 @@
geom_mean = "Geometric Mean",
geom_cv = "CV % Geometric Mean",
median = "Median",
min = "Minimum",

Check notice on line 103 in tests/testthat/test-table_pkct01.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_pkct01.R#L103

"Minimum" is wordy or unneeded
max = "Maximum"

Check notice on line 104 in tests/testthat/test-table_pkct01.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_pkct01.R#L104

"Maximum" is wordy or unneeded
),
na_level = "NE"
)
Expand Down Expand Up @@ -134,7 +134,7 @@
tmp_result <- tmp_result[tmp_result != ""]
testthat::expect_equal(tmp_result, as.character(signif(mean_vals, 3)))

# Pagination works roughly

Check notice on line 137 in tests/testthat/test-table_pkct01.R

View workflow job for this annotation

GitHub Actions / grammar

tests/testthat/test-table_pkct01.R#L137

"roughly" can weaken meaning
pag_works <- paginate_table(result, verbose = FALSE, lpp = 20)
testthat::expect_equal(length(pag_works), 12L)
})
Loading