diff --git a/renv.lock b/renv.lock index 70a7f19a..61cc6db0 100644 --- a/renv.lock +++ b/renv.lock @@ -1033,10 +1033,10 @@ }, "tidyr": { "Package": "tidyr", - "Version": "1.0.3", + "Version": "1.1.0", "Source": "Repository", "Repository": "CRAN", - "Hash": "df860e8e4e1a1b454f18537c8bc96211" + "Hash": "7395a05640bf91502dd475a84008d87e" }, "tidyselect": { "Package": "tidyselect", diff --git a/src/data/resample_fused_location.R b/src/data/resample_fused_location.R index b31048c5..7210adaf 100644 --- a/src/data/resample_fused_location.R +++ b/src/data/resample_fused_location.R @@ -14,7 +14,8 @@ phone_sensed_bins <- read_csv(snakemake@input[["phone_sensed_bins"]], col_types if(nrow(locations) > 0){ sensed_minute_bins <- phone_sensed_bins %>% - pivot_longer(-local_date, names_to = c("hour", "bin"), names_ptypes = list(hour = integer(), bin = integer()), names_sep = "_", values_to = "sensor_count") %>% + pivot_longer(-local_date, names_to = c("hour", "bin"), names_sep = "_", values_to = "sensor_count") %>% + mutate(hour = as.integer(hour), bin = as.integer(bin)) %>% complete(nesting(local_date, hour), bin = seq(0, 59,1)) %>% fill(sensor_count) %>% mutate(timestamp = as.numeric(as.POSIXct(paste0(local_date, " ", hour,":", bin,":00"), format = "%Y-%m-%d %H:%M:%S", tz = timezone)) * 1000 ) %>%