Sys.getenv— title: “Major_assignment_1_template” author: “Originally written by Bon Woo Koo & Subhro Guhathakurta; modified by Uijeong Hwang” date: ‘2024-10-16’ output: html_document —

How to use this template

You will see # TASK ///// through out this template. This indicates the beginning of a task. Right below it will be instructions for the task. Each # TASK ///// will be paired with # //TASK ///// to indicate where that specific task ends.

For example, if you see something like below…

# TASK ////////////////////////////////////////////////////////////////////////
# create a vector with element 1,2,3 and assign it into `my_vec` object
# **YOUR CODE HERE..**
# //TASK //////////////////////////////////////////////////////////////////////

What I expect you to do is to replace where it says # **YOUR CODE HERE..** with your answer, like below.

# TASK ////////////////////////////////////////////////////////////////////////
# create a vector with element 1,2,3 and assign it into `my_vec` object
my_vec <- c(1,2,3)
# //TASK //////////////////////////////////////////////////////////////////////

There can be multi-step instructions, like shown below. You may use pipe (%>%) to link multiple functions to perform the task in the instruction. Make sure that you assign the output of your task into an object with the specified name. This is to make sure that your code will run smoothly - if you change the name of the object (i.e., subset_car in the example below), all the subsequent code will NOT run properly.

# TASK ////////////////////////////////////////////////////////////////////////
# 1. Using mtcars object, extract rows where cyl equals 4
# 2. Select mpg and disp columns
# 3. Create a new column 'summation' by adding mpg and disp
# 4. assign it into `subset_car` object
# //TASK //////////////////////////////////////////////////////////////////////

I expect you to replace where it says # **YOUR CODE HERE..** with your answer, like below.

# TASK ////////////////////////////////////////////////////////////////////////
# 1. Using mtcars object, extract rows where cyl equals 4
# 2. Select mpg and disp columns
# 3. Create a new column 'summation' by adding mpg and disp
# 4. assign it into `subset_car` object
# //TASK //////////////////////////////////////////////////////////////////////

You will need to knit it, publish it on Rpubs, and submit the link.

Task description

There are a few main components in this assignment - home location, road networks, transit network, and destination. We will simulate a journey that starts from the starting point (e.g., home), drives to the nearest MARTA rail station, transfers to MARTA rail transit, and finally arrives at Midtown station. The following is a list of tasks and data we need for this analysis.

Step 1. Download Required data from GTFS. Convert it to sf format, extract MARTA rail stations, and clean the stop names to delete duplicate names. Also extract the destination station.

Step 2. Download Required data from Census. Convert Census polygons into centroids and create a subset.

Step 3. Download Required data from OSM. Convert it into an sfnetwork object and clean the network.

Step 4. Simulate a park-and-ride trip (home -> closest station -> Midtown station).

Step 5. Convert what we did in Step 4 into a function so that we can use it to repeat it in a loop.

Step 6. Run a loop to repeat the function from Step 5 to all other home location. Once finished, merge the simulation output back to Census data.

Step 7. Finally, examine whether there is any disparity in using transit to commute to midtown.

Before we start, libraries first..

library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.1
## ✔ ggplot2   3.5.1     ✔ tibble    3.2.1
## ✔ lubridate 1.9.3     ✔ tidyr     1.3.1
## ✔ purrr     1.0.2     
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag()    masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(tmap)
## 
## Attaching package: 'tmap'
## 
## The following object is masked from 'package:datasets':
## 
##     rivers
library(units)
## udunits database from /Library/Frameworks/R.framework/Versions/4.4-arm64/Resources/library/units/share/udunits/udunits2.xml
library(sf)
## Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE
library(leaflet)
library(dbscan)
## 
## Attaching package: 'dbscan'
## 
## The following object is masked from 'package:stats':
## 
##     as.dendrogram
library(sfnetworks)
library(tigris)
## To enable caching of data, set `options(tigris_use_cache = TRUE)`
## in your R script or .Rprofile.
library(tidygraph)
## 
## Attaching package: 'tidygraph'
## 
## The following object is masked from 'package:stats':
## 
##     filter
library(plotly)
## 
## Attaching package: 'plotly'
## 
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## The following object is masked from 'package:graphics':
## 
##     layout
library(osmdata)
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
library(here)
## here() starts at /Users/ryannation/Downloads
library(tidytransit)
library(tidycensus)
library(leafsync)

epsg <- 4326

Step 1. Download Required data from GTFS.

# TASK ////////////////////////////////////////////////////////////////////////
# Download MARTA (Metropolitan Atlanta Rapid Transit Authority) GTFS data using `read_gtfs()` function and assign it to `gtfs` object
gtfs <- read_gtfs("https://www.itsmarta.com/google_transit_feed/google_transit.zip")
# //TASK //////////////////////////////////////////////////////////////////////



# =========== NO MODIFICATION ZONE STARTS HERE ===============================
# Edit stop_name to append serial numbers (1, 2, etc.) to remove duplicate names
stop_dist <- stop_group_distances(gtfs$stops, by='stop_name') %>%
  filter(dist_max > 200)

gtfs$stops <- gtfs$stops %>% 
  group_by(stop_name) %>% 
  mutate(stop_name = case_when(stop_name %in% stop_dist$stop_name ~ paste0(stop_name, " (", seq(1,n()), ")"),
                               TRUE ~ stop_name))

# Create a transfer table
gtfs <- gtfsrouter::gtfs_transfer_table(gtfs, 
                                        d_limit = 200, 
                                        min_transfer_time = 120)
## Registered S3 method overwritten by 'gtfsrouter':
##   method       from  
##   summary.gtfs gtfsio
# NOTE: Converting to sf format uses stop_lat and stop_lon columns contained in gtfs$stops.
#       In the conversion process, stop_lat and stop_lon are converted into a geometry column, and
#       the output sf object do not have the lat lon column anymore.
#       But many other functions in tidytransit look for stop_lat and stop_lon.
#       So I re-create them using mutate().
gtfs <- gtfs %>% gtfs_as_sf(crs = epsg)

gtfs$stops <- gtfs$stops %>% 
  ungroup() %>% 
  mutate(stop_lat = st_coordinates(.)[,2],
         stop_lon = st_coordinates(.)[,1]) 

# Get stop_id for rails and buses
rail_stops <- gtfs$routes %>% 
  filter(route_type %in% c(1)) %>% 
  inner_join(gtfs$trips, by = "route_id") %>% 
  inner_join(gtfs$stop_times, by = "trip_id") %>% 
  inner_join(gtfs$stops, by = "stop_id") %>% 
  group_by(stop_id) %>% 
  slice(1) %>% 
  pull(stop_id)

# Extract MARTA rail stations
station <- gtfs$stops %>% filter(stop_id %in% rail_stops)

# Extract Midtown Station
midtown <- gtfs$stops %>% filter(stop_id == "134")

# Create a bounding box to which we limit our analysis
bbox <- st_bbox(c(xmin = -84.45241, ymin = 33.72109, xmax = -84.35009, ymax = 33.80101), 
                 crs = st_crs(4326)) %>% 
  st_as_sfc()

# =========== NO MODIFY ZONE ENDS HERE ========================================

Step 2. Download Required data from Census

# TASK ////////////////////////////////////////////////////////////////////////
# Specify Census API key whichever you prefer using census_api_key() function
census_api_key("961ba65800413985d189b3b1531d55702e8447ae")
## To install your API key for use in future sessions, run this function with `install = TRUE`.
# //TASK //////////////////////////////////////////////////////////////////////



# TASK ////////////////////////////////////////////////////////////////////////
# Using get_acs() function, download Census Tract level data for 2022 for Fulton, DeKalb, and Clayton in GA.
# and assign it to `census` object.
# Make sure you set geometry = TRUE.

# Required data from the Census ACS:
#  1) Median Household Income (name the column `hhinc`)
#  2) Minority Population (%) (name the column `pct_minority`)
# Note: You may need to download two or more Census ACS variables to calculate minority population (%). "Minority" here can refer to either racial minorities or racial+ethnic minorities -- it's your choice.

census <- suppressMessages(
  get_acs(geography = "tract",
          state = "GA",
          county = c("Fulton", "DeKalb", "Clayton"),
          variables = c(hhincome = 'B19019_001', pct_minority = 'B03002_003E'),
          year = 2022,
          survey = "acs5",
          geometry = TRUE,
          output = "wide")
)
##   |                                                                              |                                                                      |   0%  |                                                                              |=                                                                     |   1%  |                                                                              |==                                                                    |   2%  |                                                                              |==                                                                    |   3%  |                                                                              |===                                                                   |   4%  |                                                                              |====                                                                  |   5%  |                                                                              |====                                                                  |   6%  |                                                                              |=====                                                                 |   7%  |                                                                              |======                                                                |   8%  |                                                                              |======                                                                |   9%  |                                                                              |=======                                                               |  10%  |                                                                              |========                                                              |  11%  |                                                                              |=========                                                             |  12%  |                                                                              |=========                                                             |  13%  |                                                                              |==========                                                            |  14%  |                                                                              |==========                                                            |  15%  |                                                                              |===========                                                           |  15%  |                                                                              |===========                                                           |  16%  |                                                                              |============                                                          |  17%  |                                                                              |============                                                          |  18%  |                                                                              |=============                                                         |  18%  |                                                                              |=============                                                         |  19%  |                                                                              |==============                                                        |  20%  |                                                                              |==============                                                        |  21%  |                                                                              |===============                                                       |  21%  |                                                                              |===============                                                       |  22%  |                                                                              |================                                                      |  23%  |                                                                              |=================                                                     |  24%  |                                                                              |=================                                                     |  25%  |                                                                              |==================                                                    |  26%  |                                                                              |===================                                                   |  26%  |                                                                              |===================                                                   |  27%  |                                                                              |====================                                                  |  28%  |                                                                              |====================                                                  |  29%  |                                                                              |=====================                                                 |  29%  |                                                                              |=====================                                                 |  30%  |                                                                              |======================                                                |  31%  |                                                                              |======================                                                |  32%  |                                                                              |=======================                                               |  32%  |                                                                              |=======================                                               |  33%  |                                                                              |========================                                              |  34%  |                                                                              |========================                                              |  35%  |                                                                              |=========================                                             |  35%  |                                                                              |=========================                                             |  36%  |                                                                              |==========================                                            |  37%  |                                                                              |==========================                                            |  38%  |                                                                              |===========================                                           |  38%  |                                                                              |===========================                                           |  39%  |                                                                              |============================                                          |  40%  |                                                                              |=============================                                         |  41%  |                                                                              |=============================                                         |  42%  |                                                                              |==============================                                        |  43%  |                                                                              |===============================                                       |  44%  |                                                                              |===============================                                       |  45%  |                                                                              |================================                                      |  46%  |                                                                              |=================================                                     |  48%  |                                                                              |==================================                                    |  49%  |                                                                              |===================================                                   |  49%  |                                                                              |===================================                                   |  50%  |                                                                              |====================================                                  |  51%  |                                                                              |====================================                                  |  52%  |                                                                              |=====================================                                 |  52%  |                                                                              |=====================================                                 |  53%  |                                                                              |======================================                                |  54%  |                                                                              |=======================================                               |  55%  |                                                                              |=======================================                               |  56%  |                                                                              |========================================                              |  57%  |                                                                              |=========================================                             |  58%  |                                                                              |=========================================                             |  59%  |                                                                              |==========================================                            |  60%  |                                                                              |===========================================                           |  61%  |                                                                              |===========================================                           |  62%  |                                                                              |============================================                          |  63%  |                                                                              |=============================================                         |  64%  |                                                                              |=============================================                         |  65%  |                                                                              |==============================================                        |  66%  |                                                                              |===============================================                       |  67%  |                                                                              |===============================================                       |  68%  |                                                                              |================================================                      |  69%  |                                                                              |=================================================                     |  70%  |                                                                              |==================================================                    |  71%  |                                                                              |===================================================                   |  72%  |                                                                              |===================================================                   |  73%  |                                                                              |====================================================                  |  74%  |                                                                              |=====================================================                 |  75%  |                                                                              |=====================================================                 |  76%  |                                                                              |======================================================                |  77%  |                                                                              |=======================================================               |  78%  |                                                                              |=======================================================               |  79%  |                                                                              |========================================================              |  80%  |                                                                              |=========================================================             |  81%  |                                                                              |=========================================================             |  82%  |                                                                              |==========================================================            |  82%  |                                                                              |==========================================================            |  83%  |                                                                              |===========================================================           |  84%  |                                                                              |===========================================================           |  85%  |                                                                              |============================================================          |  85%  |                                                                              |============================================================          |  86%  |                                                                              |=============================================================         |  87%  |                                                                              |=============================================================         |  88%  |                                                                              |==============================================================        |  88%  |                                                                              |==============================================================        |  89%  |                                                                              |===============================================================       |  90%  |                                                                              |===============================================================       |  91%  |                                                                              |================================================================      |  91%  |                                                                              |================================================================      |  92%  |                                                                              |=================================================================     |  93%  |                                                                              |==================================================================    |  94%  |                                                                              |===================================================================   |  95%  |                                                                              |===================================================================   |  96%  |                                                                              |====================================================================  |  97%  |                                                                              |===================================================================== |  98%  |                                                                              |===================================================================== |  99%  |                                                                              |======================================================================|  99%  |                                                                              |======================================================================| 100%
# //TASK //////////////////////////////////////////////////////////////////////



# =========== NO MODIFICATION ZONE STARTS HERE ===============================
census <- census %>% 
  st_transform(crs = 4326) %>% 
  separate(col = NAME, into = c("tract", "county", "state"), sep = ", ")
## Warning: Expected 3 pieces. Missing pieces filled with `NA` in 600 rows [1, 2, 3, 4, 5,
## 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, ...].
# Convert it to POINT at polygon centroids and extract those that fall into bbox
# and assign it into `home` object
home <- census %>% st_centroid() %>% .[bbox,]
## Warning: st_centroid assumes attributes are constant over geometries
# =========== NO MODIFY ZONE ENDS HERE ========================================

Step 3. Download Required data from OSM.

# TASK ////////////////////////////////////////////////////////////////////////
# 1. Get OSM data using opq() function and bbox object defined in the previous code chunk.
# 2. Specify arguments for add_osm_feature() function using 
#    key = 'highway' and 
#    value = c("motorway", "trunk", "primary", "secondary", "tertiary", "residential", 
#              "motorway_link", "trunk_link", "primary_link", "secondary_link", 
#              "tertiary_link", "residential_link", "unclassified")
# 3. Convert the OSM data into an sf object using osmdata_sf() function
# 4. Convert osmdata polygons into lines using osm_poly2line() function

osm_road <- opq(bbox = bbox) %>%
  add_osm_feature(key = 'highway', value = c("motorway", "trunk", "primary", "secondary", "tertiary", "residential", "motorway_link", "trunk_link", "primary_link", "secondary_link", "tertiary_link", "residential_link", "unclassified")) %>% osmdata_sf()

if(!is.null(osm_road$osm_lines)) {
  osm_lines <- osm_road$osm_lines
} else {
  osm_lines <- osm_poly2line(osm_road$osm_polygons)
}

# TASK ////////////////////////////////////////////////////////////////////////
# 1. Convert osm_road$osm_lines into sfnetworks using as_sfnetwork() function
# 2. Activate edges
# 3. Clean the network using edge_is_multiple(), edge_is_loop(), to_spatial_subdivision(), to_spatial_smooth()
# 4. Assign the cleaned network to an object named 'osm'

if (inherits(osm_lines, "sf")) {
osm_lines_simple <-osm_lines %>% select(geometry)
osm <- as_sfnetwork(osm_lines_simple) %>%
  activate("edges") %>%
  filter(!edge_is_multiple()) %>%
  filter(!edge_is_loop())
}
# //TASK //////////////////////////////////////////////////////////////////////



# TASK ////////////////////////////////////////////////////////////////////////
# Add a new column named 'length' to the edges part of the object `osm`.
osm <- osm %>%
  mutate(length = st_length(geometry))
# //TASK //////////////////////////////////////////////////////////////////////

Step 4. Simulate a park-and-ride trip (home -> closest station -> Midtown station).

# =========== NO MODIFICATION ZONE STARTS HERE ===============================
# Extract the first row from `home` object and store it `home_1`
home_1 <- home[1,]
# =========== NO MODIFY ZONE ENDS HERE ========================================


# TASK ////////////////////////////////////////////////////////////////////////
# Find the shortest path from `home_1` to all other stations
# using st_network_paths() function.
stations <- osm %>% activate("nodes") %>% st_as_sf()

paths <- st_network_paths(
  osm,
  from = home_1,
  to = stations,
  weights = "length"
)
## Warning in shortest_paths(x, from, to, weights = weights, output = "both", : At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
print(paths)
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
# //TASK //////////////////////////////////////////////////////////////////////

  
# =========== NO MODIFICATION ZONE STARTS HERE ===============================
# Using the `paths` object, get network distances from `home_1` to all other stations.
dist_all <- map_dbl(1:nrow(paths), function(x){
  osm %>% 
    activate("nodes") %>% 
    slice(paths$node_paths[[x]]) %>% 
    st_as_sf("edges") %>% 
    pull(length) %>% 
    sum()
}) %>% unlist() 

# Replace zeros with a large value.
if (any(dist_all == 0)){
  dist_all[dist_all == 0] <- max(dist_all)
}

# Find the index of the closest station.
closest_index <- which.min(dist_all)

closest_station <- station[closest_index,]

# Find the distance to the closest station.
closest_dist <- min(dist_all)

# Calculate how long it takes to traverse `closest_dist` 
# assuming we drive at 30 miles/hour speed.
# Store the output in trvt_osm_m.
car_speed <- set_units(30, mile/h)
trvt_osm_m <- closest_dist/set_units(car_speed, m/min) %>%  # Distance divided by 30 mile/h
  as.vector(.)
# =========== NO MODIFY ZONE ENDS HERE ========================================


# TASK ////////////////////////////////////////////////////////////////////////
# 1. From `osm` object, activate nodes part and
# 2. use `closest_index` to extract the selected path
paths_closest <- osm %>%
  activate("nodes") %>%
  slice(paths$node_paths[[closest_index]]) %>%
  st_as_sf()

print(paths_closest)
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
# //TASK //////////////////////////////////////////////////////////////////////


# TASK ////////////////////////////////////////////////////////////////////////
# Use filter_stop_times() function to create a subset of stop_times data table
# for date = 2024-11-14, minimum departure time of 7AM, maximum departure time of 10AM.
# Assign the output to `am_stop_time` object
am_stop_time <- filter_stop_times(gtfs_obj = gtfs, 
                                  extract_date = "2024-11-14",
                                  min_departure_time = 3600*7,
                                  max_arrival_time = 3600*10)
# //TASK //////////////////////////////////////////////////////////////////////



# TASK ////////////////////////////////////////////////////////////////////////
# 1. Use travel_times() function to calculate travel times from the `closest_station` 
#    to all other stations during time specified in am_stop_time. 
# 2. Filter the row for which the value of 'to_stop_name' column 
#    equals midtown$stop_name. Assign it into `trvt` object.
# Load necessary files
trvt <- travel_times(filtered_stop_times = am_stop_time,
                     stop_name = "MIDTOWN STATION",
                     time_range = 3600,
                     arrival = FALSE,
                     max_transfers = 1,
                     return_coords = TRUE)
# //TASK //////////////////////////////////////////////////////////////////////



# =========== NO MODIFICATION ZONE STARTS HERE ===============================
# Divide the calculated travel time by 60 to convert the unit from seconds to minutes.
trvt_gtfs_m <- trvt$travel_time/60

# Add the travel time from home to the nearest station and
# the travel time from the nearest station to Midtown station
total_trvt <- trvt_gtfs_m
# =========== NO MODIFY ZONE ENDS HERE ========================================

Step 5. Convert Step 4 into a function

# Function definition (do not modify other parts of the code in this code chunk except for those inside the TASK section)

get_trvt <- function(home, osm, station, midtown){
  
  # TASK ////////////////////////////////////////
  # If the code in Step 4 runs fine,
  # Replace where it says **YOUR CODE HERE..** below with 
  # the ENTIRETY of the code in the previous code chunk (i.e., Step 4)
home_1 <- home[1,]

stations <- osm %>% activate("nodes") %>% st_as_sf()

paths <- st_network_paths(
  osm,
  from = home_1,
  to = stations,
  weights = "length"
)

print(paths)
dist_all <- map_dbl(1:nrow(paths), function(x){
  osm %>% 
    activate("nodes") %>% 
    slice(paths$node_paths[[x]]) %>% 
    st_as_sf("edges") %>% 
    pull(length) %>% 
    sum()
}) %>% unlist() 

# Replace zeros with a large value.
if (any(dist_all == 0)){
  dist_all[dist_all == 0] <- max(dist_all)
}

# Find the index of the closest station.
closest_index <- which.min(dist_all)

closest_station <- station[closest_index,]

# Find the distance to the closest station.
closest_dist <- min(dist_all)

# Calculate how long it takes to traverse `closest_dist` 
# assuming we drive at 30 miles/hour speed.
# Store the output in trvt_osm_m.
car_speed <- set_units(30, mile/h)
trvt_osm_m <- closest_dist/set_units(car_speed, m/min) %>%  # Distance divided by 30 mile/h
  as.vector(.)
# =========== NO MODIFY ZONE ENDS HERE ========================================


# TASK ////////////////////////////////////////////////////////////////////////
# 1. From `osm` object, activate nodes part and
# 2. use `closest_index` to extract the selected path
paths_closest <- osm %>%
  activate("nodes") %>%
  slice(paths$node_paths[[closest_index]]) %>%
  st_as_sf()

print(paths_closest)
# //TASK //////////////////////////////////////////////////////////////////////


# TASK ////////////////////////////////////////////////////////////////////////
# Use filter_stop_times() function to create a subset of stop_times data table
# for date = 2024-11-14, minimum departure time of 7AM, maximum departure time of 10AM.
# Assign the output to `am_stop_time` object
am_stop_time <- filter_stop_times(gtfs_obj = gtfs, 
                                  extract_date = "2024-11-14",
                                  min_departure_time = 3600*7,
                                  max_arrival_time = 3600*10)
# //TASK //////////////////////////////////////////////////////////////////////



# TASK ////////////////////////////////////////////////////////////////////////
# 1. Use travel_times() function to calculate travel times from the `closest_station` 
#    to all other stations during time specified in am_stop_time. 
# 2. Filter the row for which the value of 'to_stop_name' column 
#    equals midtown$stop_name. Assign it into `trvt` object.
# Load necessary files
trvt <- travel_times(filtered_stop_times = am_stop_time,
                     stop_name = "MIDTOWN STATION",
                     time_range = 3600,
                     arrival = FALSE,
                     max_transfers = 1,
                     return_coords = TRUE)
# //TASK //////////////////////////////////////////////////////////////////////



# =========== NO MODIFICATION ZONE STARTS HERE ===============================
# Divide the calculated travel time by 60 to convert the unit from seconds to minutes.
trvt_gtfs_m <- trvt$travel_time/60

# Add the travel time from home to the nearest station and
# the travel time from the nearest station to Midtown station
total_trvt <- trvt_gtfs_m
# =========== NO MODIFY ZONE ENDS HERE ========================================
  
  # //TASK //////////////////////////////////////

  # =========== NO MODIFICATION ZONE STARTS HERE ===============================
  if (length(total_trvt) == 0) {total_trvt = 0}

  return(total_trvt)
  # =========== NO MODIFY ZONE ENDS HERE ========================================
}

Step 6. Apply the function for the whole study area

# Prepare an empty vector
total_trvt <- vector("numeric", nrow(home))

# Apply the function for all Census Tracts
# Fill `total_trvt` object with the calculated time
for (i in 1:nrow(home)){
  total_trvt[i] <- get_trvt(home[i,], osm, station, midtown)
}
## Warning in shortest_paths(x, from, to, weights = weights, output = "both", : At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [53]> <int [52]>
##  4 <int [54]> <int [53]>
##  5 <int [49]> <int [48]>
##  6 <int [50]> <int [49]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [29]> <int [28]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.38402 ymin: 33.78172 xmax: -84.38385 ymax: 33.78321
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.38385 33.78321)
## 2 (-84.38402 33.78172)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [49]> <int [48]>
##  4 <int [50]> <int [49]>
##  5 <int [45]> <int [44]>
##  6 <int [46]> <int [45]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [33]> <int [32]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.38478 ymin: 33.77358 xmax: -84.38319 ymax: 33.77368
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.38478 33.77368)
## 2 (-84.38319 33.77358)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [82]> <int [81]>
##  4 <int [83]> <int [82]>
##  5 <int [78]> <int [77]>
##  6 <int [79]> <int [78]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [45]> <int [44]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.39311 ymin: 33.79136 xmax: -84.39274 ymax: 33.79197
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.39274 33.79136)
## 2 (-84.39311 33.79197)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [54]> <int [53]>
##  4 <int [55]> <int [54]>
##  5 <int [50]> <int [49]>
##  6 <int [51]> <int [50]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [33]> <int [32]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.37863 ymin: 33.75973 xmax: -84.37852 ymax: 33.7599
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.37852 33.75973)
## 2  (-84.37863 33.7599)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [57]> <int [56]>
##  4 <int [58]> <int [57]>
##  5 <int [53]> <int [52]>
##  6 <int [54]> <int [53]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [54]> <int [53]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.35435 ymin: 33.77383 xmax: -84.3541 ymax: 33.77383
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.3541 33.77383)
## 2 (-84.35435 33.77383)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [28]> <int [27]>
##  4 <int [29]> <int [28]>
##  5 <int [24]> <int [23]>
##  6 <int [25]> <int [24]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [40]> <int [39]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.39185 ymin: 33.74965 xmax: -84.39066 ymax: 33.7503
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.39185 33.7503)
## 2 (-84.39066 33.74965)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [27]> <int [26]>
##  4 <int [28]> <int [27]>
##  5 <int [23]> <int [22]>
##  6 <int [24]> <int [23]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [27]> <int [26]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.38626 ymin: 33.75419 xmax: -84.38611 ymax: 33.7545
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.38611 33.7545)
## 2 (-84.38626 33.75419)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.4063 ymin: 33.76913 xmax: -84.40629 ymax: 33.77003
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.4063 33.76913)
## 2 (-84.40629 33.77003)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.39189 ymin: 33.76781 xmax: -84.39139 ymax: 33.76781
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.39189 33.76781)
## 2 (-84.39139 33.76781)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths  edge_paths 
##    <list>      <list>     
##  1 <int [0]>   <int [0]>  
##  2 <int [0]>   <int [0]>  
##  3 <int [141]> <int [140]>
##  4 <int [142]> <int [141]>
##  5 <int [137]> <int [136]>
##  6 <int [138]> <int [137]>
##  7 <int [0]>   <int [0]>  
##  8 <int [0]>   <int [0]>  
##  9 <int [0]>   <int [0]>  
## 10 <int [104]> <int [103]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.40276 ymin: 33.7589 xmax: -84.40275 ymax: 33.75977
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.40276 33.7589)
## 2 (-84.40275 33.75977)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [90]> <int [89]>
##  4 <int [91]> <int [90]>
##  5 <int [86]> <int [85]>
##  6 <int [87]> <int [86]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [53]> <int [52]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.39918 ymin: 33.77825 xmax: -84.39779 ymax: 33.77827
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.39918 33.77827)
## 2 (-84.39779 33.77825)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.45049 ymin: 33.75735 xmax: -84.44978 ymax: 33.7601
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.44978 33.75735)
## 2  (-84.45049 33.7601)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [40]> <int [39]>
##  4 <int [41]> <int [40]>
##  5 <int [36]> <int [35]>
##  6 <int [37]> <int [36]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [52]> <int [51]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.3935 ymin: 33.73607 xmax: -84.39348 ymax: 33.73679
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.3935 33.73607)
## 2 (-84.39348 33.73679)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [62]> <int [61]>
##  4 <int [63]> <int [62]>
##  5 <int [58]> <int [57]>
##  6 <int [59]> <int [58]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [50]> <int [49]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.37776 ymin: 33.7686 xmax: -84.37774 ymax: 33.77062
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.37776 33.7686)
## 2 (-84.37774 33.77062)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [48]> <int [47]>
##  4 <int [49]> <int [48]>
##  5 <int [44]> <int [43]>
##  6 <int [45]> <int [44]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [45]> <int [44]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.35478 ymin: 33.76692 xmax: -84.35405 ymax: 33.76793
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.35405 33.76793)
## 2 (-84.35478 33.76692)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [54]> <int [53]>
##  4 <int [55]> <int [54]>
##  5 <int [50]> <int [49]>
##  6 <int [51]> <int [50]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [32]> <int [31]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.38301 ymin: 33.78543 xmax: -84.38217 ymax: 33.78545
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.38301 33.78545)
## 2 (-84.38217 33.78543)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.41772 ymin: 33.73799 xmax: -84.41448 ymax: 33.73824
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.41773 33.73799)
## 2 (-84.41448 33.73824)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [57]> <int [56]>
##  4 <int [58]> <int [57]>
##  5 <int [53]> <int [52]>
##  6 <int [54]> <int [53]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [18]> <int [17]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.39162 ymin: 33.77938 xmax: -84.39118 ymax: 33.78122
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.39162 33.78122)
## 2 (-84.39118 33.77938)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.40318 ymin: 33.72931 xmax: -84.40308 ymax: 33.73193
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.40308 33.73193)
## 2 (-84.40318 33.72931)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [51]> <int [50]>
##  4 <int [52]> <int [51]>
##  5 <int [47]> <int [46]>
##  6 <int [48]> <int [47]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [81]> <int [80]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.40301 ymin: 33.75126 xmax: -84.40285 ymax: 33.7519
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.40285 33.7519)
## 2 (-84.40301 33.75126)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.36369 ymin: 33.78637 xmax: -84.36342 ymax: 33.7866
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.36342 33.7866)
## 2 (-84.36369 33.78637)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [76]> <int [75]>
##  4 <int [77]> <int [76]>
##  5 <int [72]> <int [71]>
##  6 <int [73]> <int [72]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [37]> <int [36]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.37959 ymin: 33.77951 xmax: -84.37766 ymax: 33.77952
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.37959 33.77952)
## 2 (-84.37766 33.77951)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [38]> <int [37]>
##  4 <int [39]> <int [38]>
##  5 <int [34]> <int [33]>
##  6 <int [35]> <int [34]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [68]> <int [67]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.40842 ymin: 33.74348 xmax: -84.40754 ymax: 33.74432
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.40842 33.74432)
## 2 (-84.40754 33.74348)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.38006 ymin: 33.79933 xmax: -84.37762 ymax: 33.79982
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.37762 33.79933)
## 2 (-84.38005 33.79982)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.4128 ymin: 33.75093 xmax: -84.41132 ymax: 33.75094
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.41132 33.75093)
## 2  (-84.4128 33.75093)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [63]> <int [62]>
##  4 <int [64]> <int [63]>
##  5 <int [59]> <int [58]>
##  6 <int [60]> <int [59]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [60]> <int [59]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.38024 ymin: 33.75719 xmax: -84.37994 ymax: 33.75745
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.38024 33.75719)
## 2 (-84.37994 33.75745)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.36518 ymin: 33.73976 xmax: -84.35821 ymax: 33.74197
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.35821 33.73976)
## 2 (-84.36518 33.74197)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [89]> <int [88]>
##  4 <int [90]> <int [89]>
##  5 <int [85]> <int [84]>
##  6 <int [86]> <int [85]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [52]> <int [51]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.40742 ymin: 33.78302 xmax: -84.40722 ymax: 33.78302
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1 (-84.40742 33.78302)
## 2 (-84.40722 33.78302)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [0]>  <int [0]> 
##  4 <int [0]>  <int [0]> 
##  5 <int [0]>  <int [0]> 
##  6 <int [0]>  <int [0]> 
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [0]>  <int [0]> 
## # ℹ 6,058 more rows
## Simple feature collection with 0 features and 0 fields
## Bounding box:  xmin: NA ymin: NA xmax: NA ymax: NA
## Geodetic CRS:  WGS 84
## # A tibble: 0 × 1
## # ℹ 1 variable: geometry <GEOMETRY [°]>
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## # A tibble: 6,068 × 2
##    node_paths edge_paths
##    <list>     <list>    
##  1 <int [0]>  <int [0]> 
##  2 <int [0]>  <int [0]> 
##  3 <int [81]> <int [80]>
##  4 <int [82]> <int [81]>
##  5 <int [77]> <int [76]>
##  6 <int [78]> <int [77]>
##  7 <int [0]>  <int [0]> 
##  8 <int [0]>  <int [0]> 
##  9 <int [0]>  <int [0]> 
## 10 <int [42]> <int [41]>
## # ℹ 6,058 more rows
## Simple feature collection with 2 features and 0 fields
## Geometry type: POINT
## Dimension:     XY
## Bounding box:  xmin: -84.38569 ymin: 33.7795 xmax: -84.38569 ymax: 33.77955
## Geodetic CRS:  WGS 84
## # A tibble: 2 × 1
##               geometry
##            <POINT [°]>
## 1  (-84.38569 33.7795)
## 2 (-84.38569 33.77955)
## Warning in total_trvt[i] <- get_trvt(home[i, ], osm, station, midtown): number
## of items to replace is not a multiple of replacement length
# Cbind the calculated travel time back to `home`
home_done <- home %>% 
  cbind(trvt = total_trvt)

Step 7. Create maps and plots

Run the code below to generate thematic maps and plots

Write a short description of what you observe from the maps and plots

# Map
tmap_mode('view')
## ℹ tmap mode set to "view".
tm_shape(census[census$GEOID %in% home$GEOID,]) + 
  tm_polygons(fill = "hhincomeE", fill.palette = 'GnBu', breaks = c(0, 20000, 40000, 60000, 80000, 100000, 120000)) + 
  tm_shape(home_done) + 
  tm_dots(fill = "trvt",col ="trvt", palette = 'Reds', size = 0.1)
## 
## ── tmap v3 code detected ───────────────────────────────────────────────────────
## [v3->v4] `tm_polygons()`: migrate the argument(s) related to the scale of the
## visual variable `fill` namely 'breaks' to fill.scale = tm_scale(<HERE>).[v3->v4] tm_dots(): use 'fill' for the fill color of polygons/symbols (instead of 'col'), and 'col' for the outlines (instead of 'border.col')
## Warning: Values have found that are higher than the highest break. They are
## assigned to the highest interval
## The visual variable "fill" of the layer "dotssymbols" contains a unique value. Therefore a discrete scale is applied (tm_scale_discrete).
## [cols4all] color palettes: use palettes from the R package cols4all. Run 'cols4all::c4a_gui()' to explore them. The old palette name "Reds" is named "reds" (in long format "brewer.reds")
# ggplot
inc <- ggplot(data = home_done,
              aes(x = hhincomeE, y = trvt)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(x = "Median Annual Household Income",
       y = "Park-and-ride Travel Time from Home to Midtown Station") +
  theme_bw()

minority <- ggplot(data = home_done,
                   aes(x = pct_minority, y = trvt)) +
  geom_point() +
  geom_smooth(method = "lm", se = FALSE) +
  labs(x = "Minority Population (%)",
       y = "Park-and-ride Travel Time from Home to Midtown Station") +
  theme_bw()


ggpubr::ggarrange(inc, minority)
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 6 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 6 rows containing missing values or values outside the scale range
## (`geom_point()`).
## `geom_smooth()` using formula = 'y ~ x'

###After viewing these graphs, it appears I did something wrong. I had some issues with the travel time section, but I’m not sure what went wrong.