From 4de1fb5f411c66810105f3045bf539c7aaa63675 Mon Sep 17 00:00:00 2001 From: Stefan Bundfuss <80953585+bundfussr@users.noreply.github.com> Date: Tue, 17 Dec 2024 17:46:05 +0100 Subject: [PATCH 1/2] Closes #2563 no_list_columns: filter before check (#2611) * #2563 no_list_columns: add check to avoid list columns * #2563 no_list_columns: update documentation * #2563 no_list_columns: fix example and add see also * #2563 no_list_columns: avoid package name prefix * #2563 no_list_columns: update required admiraldev version * #2563 no_list_columns: split files (and clean up tests) * #2563 no_list_columns: update man * #2563 no_list_columns: filter before check --------- Co-authored-by: Daniel Sjoberg --- R/derive_vars_transposed.R | 3 ++- tests/testthat/test-derive_vars_transposed.R | 9 +++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/R/derive_vars_transposed.R b/R/derive_vars_transposed.R index d21322e73f..a0b67c1a1b 100644 --- a/R/derive_vars_transposed.R +++ b/R/derive_vars_transposed.R @@ -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( @@ -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, diff --git a/tests/testthat/test-derive_vars_transposed.R b/tests/testthat/test-derive_vars_transposed.R index d2e1db5a8d..ee1b8d3cb3 100644 --- a/tests/testthat/test-derive_vars_transposed.R +++ b/tests/testthat/test-derive_vars_transposed.R @@ -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, From ef04a31d4efec9cbe85ab4241342ee0b1969d7d4 Mon Sep 17 00:00:00 2001 From: bundfussr Date: Tue, 17 Dec 2024 16:46:54 +0000 Subject: [PATCH 2/2] [skip actions] Bump version to 1.1.1.9042 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index cb926acf51..97bba48a0a 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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", , "ben.x.straub@gsk.com", role = c("aut", "cre")), person("Stefan", "Bundfuss", role = "aut",