From 6c1d42a32fc70d67ea849fca5fdc86b92ae825fb Mon Sep 17 00:00:00 2001 From: jarathomas Date: Fri, 13 Aug 2021 14:49:23 -0400 Subject: [PATCH] bug fix --- CrossVA/DESCRIPTION | 2 +- CrossVA/R/odk2openVA_v141.R | 5 ++--- CrossVA/R/odk2openVA_v151.R | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/CrossVA/DESCRIPTION b/CrossVA/DESCRIPTION index 4d2a05f..2b37531 100644 --- a/CrossVA/DESCRIPTION +++ b/CrossVA/DESCRIPTION @@ -1,7 +1,7 @@ Package: CrossVA Type: Package Title: Verbal Autopsy Data Transformation for InSilicoVA and InterVA5 Algorithms -Version: 1.0.0 +Version: 1.0.1 Description: Enables transformation of Verbal Autopsy data collected with the WHO 2016 questionnaire (versions 1.4.1 & 1.5.1) or the WHO 2014 questionnaire for automated coding of Cause of Death using the InSilicoVA (data.type = "WHO2016") and InterVA5 algorithms. Previous versions of this package supported user-supplied mappings (via the map_records function), but diff --git a/CrossVA/R/odk2openVA_v141.R b/CrossVA/R/odk2openVA_v141.R index 4be1e12..470f096 100644 --- a/CrossVA/R/odk2openVA_v141.R +++ b/CrossVA/R/odk2openVA_v141.R @@ -987,9 +987,8 @@ odk2openVA_v141 <- function (odk, id_col = "meta.instanceID") { nMonths[is.na(odk[ , indexDataM]) & !is.na(odk[ , indexDataD])] <- 0 nDays[is.na(odk[ , indexDataD]) & !is.na(odk[ , indexDataM])] <- 0 naMonthsAndDays <- is.na(odk[ , indexDataM]) & is.na(odk[ , indexDataD]) - iv5Out[nMonths + nDays/30.4 <=12 & !naMonthsAndDays, 284] <- "y" - iv5Out[nMonths + nDays/30.4 > 12 & !naMonthsAndDays, 284] <- "n" - + iv5Out[!naMonthsAndDays & (nMonths + nDays/30.4) <=12, 284] <- "y" + iv5Out[!naMonthsAndDays & (nMonths + nDays/30.4) > 12, 284] <- "n" #285) Was the baby born in a health facility or clinic? born fac indexData <- which(stri_endswith_fixed(odkNames, whoNames[285])) diff --git a/CrossVA/R/odk2openVA_v151.R b/CrossVA/R/odk2openVA_v151.R index 7c5b715..68aafed 100644 --- a/CrossVA/R/odk2openVA_v151.R +++ b/CrossVA/R/odk2openVA_v151.R @@ -984,8 +984,8 @@ odk2openVA_v151 <- function (odk, id_col = "meta.instanceID") { nMonths[is.na(odk[ , indexDataM]) & !is.na(odk[ , indexDataD])] <- 0 nDays[is.na(odk[ , indexDataD]) & !is.na(odk[ , indexDataM])] <- 0 naMonthsAndDays <- is.na(odk[ , indexDataM]) & is.na(odk[ , indexDataD]) - iv5Out[nMonths + nDays/30.4 <=12 & !naMonthsAndDays, 284] <- "y" - iv5Out[nMonths + nDays/30.4 > 12 & !naMonthsAndDays, 284] <- "n" + iv5Out[!naMonthsAndDays & (nMonths + nDays/30.4) <=12, 284] <- "y" + iv5Out[!naMonthsAndDays & (nMonths + nDays/30.4) > 12, 284] <- "n" #285) Was the baby born in a health facility or clinic? born fac indexData <- which(stri_endswith_fixed(odkNames, whoNames[285]))