From 5a2049f533357120d4effa09e17866f9bf191e7d Mon Sep 17 00:00:00 2001 From: JulioV Date: Mon, 27 Apr 2020 21:55:23 +0000 Subject: [PATCH] Replace NAs with 0 for bluetooth countscansmostuniquedevice --- src/features/bluetooth_features.R | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/features/bluetooth_features.R b/src/features/bluetooth_features.R index 8027dd10..750dbd53 100644 --- a/src/features/bluetooth_features.R +++ b/src/features/bluetooth_features.R @@ -1,6 +1,7 @@ source("packrat/init.R") library(dplyr) +library(tidyr) filter_by_day_segment <- function(data, day_segment) { if(day_segment %in% c("morning", "afternoon", "evening", "night")) @@ -38,4 +39,6 @@ for(requested_feature in requested_features){ features <- merge(features, feature, by="local_date", all = TRUE) } +features <- features %>% mutate_at(vars(contains("countscansmostuniquedevice")), list( ~ replace_na(., 0))) + write.csv(features, snakemake@output[[1]], row.names = FALSE) \ No newline at end of file