From 06bb2b9c736fca6505eeb2dd0a06e29c456389ce Mon Sep 17 00:00:00 2001 From: JulioV Date: Fri, 18 Sep 2020 11:26:10 -0400 Subject: [PATCH] Fix accuracy bug in barnett location features --- src/features/location_barnett_features.R | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/features/location_barnett_features.R b/src/features/location_barnett_features.R index 94e99593..b90aa039 100644 --- a/src/features/location_barnett_features.R +++ b/src/features/location_barnett_features.R @@ -68,8 +68,12 @@ if (nrow(location) > 1){ location <- location %>% select(timestamp, latitude = double_latitude, longitude = double_longitude, altitude = double_altitude, accuracy) - - outputMobility <- MobilityFeatures(location, ACCURACY_LIM = accuracy_limit, tz = timezone) + if(nrow(location %>% filter(accuracy < accuracy_limit)) > 1){ + outputMobility <- MobilityFeatures(location, ACCURACY_LIM = accuracy_limit, tz = timezone) + } else { + print(paste("Cannot compute location features because there are no rows with an accuracy value lower than ACCURACY_LIMIT", accuracy_limit)) + outputMobility <- NULL + } if(is.null(outputMobility)){ write_empty_file(snakemake@output[[1]], requested_features)