Skip to content

Commit

Permalink
Merge branch 'main' into 2545_documentation_clarification_vignette_de…
Browse files Browse the repository at this point in the history
…rive_basetype_records
  • Loading branch information
jimrothstein authored Dec 19, 2024
2 parents 2e1f425 + ef04a31 commit 272c335
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: admiral
Title: ADaM in R Asset Library
Version: 1.1.1.9041
Version: 1.1.1.9042
Authors@R: c(
person("Ben", "Straub", , "[email protected]", role = c("aut", "cre")),
person("Stefan", "Bundfuss", role = "aut",
Expand Down
3 changes: 2 additions & 1 deletion R/derive_vars_transposed.R
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,8 @@ derive_vars_transposed <- function(dataset,
optional = TRUE
)

dataset_merge <- filter_if(dataset_merge, filter)

# check for duplicates in dataset_merge as these will create list columns,
# which is not acceptable for ADaM datasets
signal_duplicate_records(
Expand All @@ -134,7 +136,6 @@ derive_vars_transposed <- function(dataset,
)

dataset_transposed <- dataset_merge %>%
filter_if(filter) %>%
pivot_wider(
names_from = !!key_var,
values_from = !!value_var,
Expand Down
9 changes: 9 additions & 0 deletions tests/testthat/test-derive_vars_transposed.R
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ test_that("derive_vars_transposed Test 2: filtering the merge dataset works", {
"STUDY01", "P02", 31, 3,
"STUDY01", "P03", 42, NA
)

dataset_merge <- tibble::tribble(
~STUDYID, ~USUBJID, ~TESTCD, ~VALUE,
"STUDY01", "P01", "T01", 31,
"STUDY01", "P01", "T02", 5,
"STUDY01", "P02", "T01", 3,
"STUDY01", "P01", "T02", 9
)

actual_output <- derive_vars_transposed(
dataset,
dataset_merge,
Expand Down

0 comments on commit 272c335

Please sign in to comment.