small edits

This commit is contained in:
Ben Varick 2024-11-23 21:39:14 -06:00
parent a0c8508737
commit 93b97f3cec
Signed by: ben
SSH Key Fingerprint: SHA256:jWnpFDAcacYM5aPFpYRqlsamlDyKNpSj3jj+k4ojtUo

View File

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