Skip to content

Commit 2493852

Browse files
authored
Merge pull request #1435 from cmu-delphi/splitoptions-pass-na
Fix pipeline when barrier column is all NAs part 2
2 parents 9394955 + 69b8971 commit 2493852

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

facebook/delphiFacebook/R/variables.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -646,8 +646,10 @@ code_vaccines <- function(input_data, wave) {
646646
# If the entire column is NA, ifelse() results in a logical vector, not a
647647
# character vector, which confuses split_options; since the result should be
648648
# NA anyway
649+
vaccine_barriers <- as.character(
650+
ifelse(vaccine_barriers == "13", NA_character_, vaccine_barriers)
651+
)
649652
if (any(!is.na(vaccine_barriers))) {
650-
vaccine_barriers <- ifelse(vaccine_barriers == "13", NA_character_, vaccine_barriers)
651653
vaccine_barriers <- split_options(vaccine_barriers)
652654
}
653655

@@ -786,11 +788,11 @@ code_vaccines <- function(input_data, wave) {
786788
# If the entire column is NA, ifelse() results in a logical vector, not a
787789
# character vector, which confuses split_options; since the result should be
788790
# NA anyway
789-
if (any(!is.na(input_data$V15b))) {
790-
vaccine_barriers <- ifelse(input_data$V15b == "13", NA, input_data$V15b)
791+
vaccine_barriers <- as.character(
792+
ifelse(input_data$V15b == "13", NA, input_data$V15b)
793+
)
794+
if (any(!is.na(vaccine_barriers))) {
791795
vaccine_barriers <- split_options(vaccine_barriers)
792-
} else {
793-
vaccine_barriers <- input_data$V15b
794796
}
795797

796798
input_data$v_vaccine_barrier_eligible_tried <- is_selected(vaccine_barriers, "1")

facebook/delphiFacebook/src/RcppExports.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,6 @@
55

66
using namespace Rcpp;
77

8-
#ifdef RCPP_USE_GLOBAL_ROSTREAM
9-
Rcpp::Rostream<true>& Rcpp::Rcout = Rcpp::Rcpp_cout_get();
10-
Rcpp::Rostream<false>& Rcpp::Rcerr = Rcpp::Rcpp_cerr_get();
11-
#endif
12-
138
// is_selected_cpp
149
LogicalVector is_selected_cpp(List responses, String target);
1510
RcppExport SEXP _delphiFacebook_is_selected_cpp(SEXP responsesSEXP, SEXP targetSEXP) {

0 commit comments

Comments
 (0)