small edits
This commit is contained in:
parent
a0c8508737
commit
93b97f3cec
@ -10,18 +10,19 @@ org <- "32b7fde0efd8a3b3"
|
|||||||
bucket <- "metro_vehicles"
|
bucket <- "metro_vehicles"
|
||||||
|
|
||||||
|
|
||||||
days <- 7
|
days <- 3
|
||||||
|
|
||||||
influx_connection <- InfluxDBClient$new(url = "https://influxdb.dendroalsia.net",
|
influx_connection <- InfluxDBClient$new(url = "https://influxdb.dendroalsia.net",
|
||||||
token = token,
|
token = token,
|
||||||
org = org)
|
org = org)
|
||||||
#---
|
#--- Query influxdb for data
|
||||||
|
|
||||||
# Fields to query
|
# Fields to query
|
||||||
fields <- c("des", "spd", "pdist", "lon", "lat", "dly", "origtatripno")
|
fields <- c("des", "spd", "pdist", "lon", "lat", "dly", "origtatripno")
|
||||||
|
|
||||||
# An empty list to store results for each field
|
# An empty list to store results for each field
|
||||||
results <- vector("list", length(fields))
|
results <- vector("list", length(fields))
|
||||||
|
time_start <- Sys.time()
|
||||||
# Loop through each field, get data, and coerce types if needed
|
# Loop through each field, get data, and coerce types if needed
|
||||||
for (i in seq_along(fields)) {
|
for (i in seq_along(fields)) {
|
||||||
field <- fields[i]
|
field <- fields[i]
|
||||||
@ -48,6 +49,9 @@ metro_raw <- bind_rows(results)
|
|||||||
|
|
||||||
metro_raw <- pivot_wider(metro_raw, values_from = value, names_from = field) %>%
|
metro_raw <- pivot_wider(metro_raw, values_from = value, names_from = field) %>%
|
||||||
distinct(pid, vid, lat, lon, spd, .keep_all = TRUE)
|
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")
|
routes_categorized <- read_csv(file = "routes_categorized.csv", col_types = "cc")
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user