From c728c4d8d427ba82ec05c488053700e4d81952ce Mon Sep 17 00:00:00 2001 From: jeffeaton Date: Wed, 27 Feb 2019 19:36:13 +0000 Subject: [PATCH] remove duplicated values in labels; fixed issue #79 --- R/read_dhs_flat.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/R/read_dhs_flat.R b/R/read_dhs_flat.R index be2027e..f19d35f 100644 --- a/R/read_dhs_flat.R +++ b/R/read_dhs_flat.R @@ -78,6 +78,9 @@ parse_dcf <- function(dcf, all_lower=TRUE) { values <- Map("names<-", values, labels) values <- lapply(values, function(x) x[!is.na(x) & nzchar(names(x))]) + ## remove duplicate values from labels + values <- lapply(values, function(x) x[!duplicated(x)]) + dcf$labels[hasvs] <- values ## Expand dictionary for multiple occurences