Update tidyr and fix resample pivot_longer bug

pull/95/head
JulioV 2020-06-12 14:51:38 -04:00
parent 48591a4bd3
commit 3287866f4b
2 changed files with 4 additions and 3 deletions

View File

@ -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",

View File

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