Fix accuracy bug in barnett location features

pull/104/head
JulioV 2020-09-18 11:26:10 -04:00
parent ca1821e314
commit 06bb2b9c73
1 changed files with 6 additions and 2 deletions

View File

@ -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)