From 7d265e06c70d7f8ea2d527750a53fad5bc1790c3 Mon Sep 17 00:00:00 2001 From: jason-p-pickering Date: Wed, 24 May 2023 08:31:17 +0200 Subject: [PATCH] Fix issue with blank DP targets in unPackSNUxIM --- R/unPackSNUxIM.R | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/R/unPackSNUxIM.R b/R/unPackSNUxIM.R index 30530ac50..b4e5a2df7 100644 --- a/R/unPackSNUxIM.R +++ b/R/unPackSNUxIM.R @@ -222,12 +222,11 @@ checkNonEqualTargets <- function(d, original_targets) { #If the main tab value is missing and the DataPackTarget is zero, ignore dplyr::mutate(are_equal = dplyr::case_when(is.na(MainTabsTarget) & DataPackTarget == 0 ~ TRUE, is.na(MainTabsTarget) & DataPackTarget != 0 ~ FALSE, + !is.na(MainTabsTarget) & is.na(DataPackTarget) ~ FALSE, TRUE ~ are_equal)) %>% dplyr::filter(!are_equal | is.na(are_equal)) %>% - #Filter non-allocated data to prevent false positives with this test - #Other tests should catch whether there is data in the main tabs - #but which has not been allocated - dplyr::filter(!is.na(DataPackTarget)) %>% + #Filter instances where both the DP and PSNUxIM Target are NA + dplyr::filter(!(is.na(DataPackTarget) & is.na(MainTabsTarget))) %>% dplyr::rename("PSNUxIM Target" = DataPackTarget) attr(d$tests$non_equal_targets, "test_name") <- "Non-equal targets"