diff --git a/madison-metro.R b/madison-metro.R index 287ce08..4e8265f 100644 --- a/madison-metro.R +++ b/madison-metro.R @@ -10,18 +10,19 @@ org <- "32b7fde0efd8a3b3" bucket <- "metro_vehicles" -days <- 7 +days <- 3 influx_connection <- InfluxDBClient$new(url = "https://influxdb.dendroalsia.net", token = token, org = org) -#--- +#--- Query influxdb for data + # Fields to query fields <- c("des", "spd", "pdist", "lon", "lat", "dly", "origtatripno") # An empty list to store results for each field results <- vector("list", length(fields)) - +time_start <- Sys.time() # Loop through each field, get data, and coerce types if needed for (i in seq_along(fields)) { field <- fields[i] @@ -48,6 +49,9 @@ metro_raw <- bind_rows(results) metro_raw <- pivot_wider(metro_raw, values_from = value, names_from = field) %>% distinct(pid, vid, lat, lon, spd, .keep_all = TRUE) +time_end <- Sys.time() +difftime(time_start, time_end) + routes_categorized <- read_csv(file = "routes_categorized.csv", col_types = "cc")