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)