R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

Instructions

Park-and-Ride Simulation The transit agency MARTA is interested in evaluating how long it takes for residents in different parts of Atlanta to travel from their homes to a major employment center (e.g., Midtown) using a park-and-ride approach. The goal is to understand whether there are any disparities in travel times across neighborhoods.

Your task is to calculate these travel times using data from OSM, GTFS, and the Census. This assignment provides a code template, which you can download here. The template includes detailed guidance on how to use it, the tasks you will complete, and the step-by-step workflow.

Take time to carefully review how the template works—it may require some effort to understand at first, so be sure to start early.

Submission

Task description

Park-and-Ride Simulation

In this assignment, you will simulate a journey that begins at a Census Tract centroid, drives to the nearest MARTA station, and then take the MARTA to the Midtown station. You will then compare how travel time varies by different Census Tracts. The steps and data required for this analysis are outlined below.

Step 1. Download the required GTFS data. Convert it to sf format, extract MARTA rail stations, and clean the stop names to remove duplicates. Also, extract the destination station.

Step 2. Download the required Census data. Convert Census Tract polygons into centroids and create a subset for analysis.

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

Step 4. Simulate a park-and-ride trip (from a test origin → closest station → Midtown station).

Step 5. Turn the simulation process from Step 4 into a reusable function.

Step 6. Apply the function from Step 5 iteratively to all home locations.

Step 7.Finally, create maps and plots to analyze whether there are any disparities in transit accessibility when commuting to Midtown.

Step 0. Packages

liby <-c("ggplot2", "tidyverse", "tidyr", "ggpmisc", "usmap", "tmap", "stringr", "sf", "viridis", "tidytransit", "here", "units", "leaflet", "tidycensus", "plotly", "tidygraph", "leafsync", "leafpop", "magrittr", "dbscan", "sfnetworks", "tigris", "osmdata", "nominatimlite", "lubridate", "gtfsrouter", "RColorBrewer")
lapply(liby, require, character.only = TRUE)
## Loading required package: ggplot2
## Loading required package: tidyverse
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr     1.1.4     ✔ readr     2.1.5
## ✔ forcats   1.0.0     ✔ stringr   1.5.2
## ✔ lubridate 1.9.4     ✔ tibble    3.3.0
## ✔ purrr     1.1.0     ✔ tidyr     1.3.1
## ── 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
## Loading required package: ggpmisc
## 
## Loading required package: ggpp
## 
## Registered S3 methods overwritten by 'ggpp':
##   method                  from   
##   heightDetails.titleGrob ggplot2
##   widthDetails.titleGrob  ggplot2
## 
## 
## Attaching package: 'ggpp'
## 
## 
## The following object is masked from 'package:ggplot2':
## 
##     annotate
## 
## 
## Loading required package: usmap
## 
## Loading required package: tmap
## 
## Loading required package: sf
## 
## Linking to GEOS 3.13.1, GDAL 3.11.0, PROJ 9.6.0; sf_use_s2() is TRUE
## 
## Loading required package: viridis
## 
## Loading required package: viridisLite
## 
## Loading required package: tidytransit
## 
## Loading required package: here
## 
## here() starts at C:/Users/akaamah3/Documents/SCaRP Course Materials_Fall2025/Into_to_Urban_Analytics/CP8883_working_with_R
## 
## Loading required package: units
## 
## udunits database from C:/Users/akaamah3/AppData/Local/Programs/R/R-4.5.1/library/units/share/udunits/udunits2.xml
## 
## Loading required package: leaflet
## 
## Loading required package: tidycensus
## 
## Loading required package: 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
## 
## 
## Loading required package: tidygraph
## 
## 
## Attaching package: 'tidygraph'
## 
## 
## The following object is masked from 'package:stats':
## 
##     filter
## 
## 
## Loading required package: leafsync
## 
## Loading required package: leafpop
## 
## Loading required package: magrittr
## 
## 
## Attaching package: 'magrittr'
## 
## 
## The following object is masked from 'package:purrr':
## 
##     set_names
## 
## 
## The following object is masked from 'package:tidyr':
## 
##     extract
## 
## 
## Loading required package: dbscan
## 
## 
## Attaching package: 'dbscan'
## 
## 
## The following object is masked from 'package:stats':
## 
##     as.dendrogram
## 
## 
## Loading required package: sfnetworks
## 
## Loading required package: tigris
## 
## To enable caching of data, set `options(tigris_use_cache = TRUE)`
## in your R script or .Rprofile.
## 
## Loading required package: osmdata
## 
## Data (c) OpenStreetMap contributors, ODbL 1.0. https://www.openstreetmap.org/copyright
## 
## Loading required package: nominatimlite
## 
## Loading required package: gtfsrouter
## Warning: package 'gtfsrouter' was built under R version 4.5.2
## Registered S3 method overwritten by 'gtfsrouter':
##   method       from  
##   summary.gtfs gtfsio
## Loading required package: RColorBrewer
## [[1]]
## [1] TRUE
## 
## [[2]]
## [1] TRUE
## 
## [[3]]
## [1] TRUE
## 
## [[4]]
## [1] TRUE
## 
## [[5]]
## [1] TRUE
## 
## [[6]]
## [1] TRUE
## 
## [[7]]
## [1] TRUE
## 
## [[8]]
## [1] TRUE
## 
## [[9]]
## [1] TRUE
## 
## [[10]]
## [1] TRUE
## 
## [[11]]
## [1] TRUE
## 
## [[12]]
## [1] TRUE
## 
## [[13]]
## [1] TRUE
## 
## [[14]]
## [1] TRUE
## 
## [[15]]
## [1] TRUE
## 
## [[16]]
## [1] TRUE
## 
## [[17]]
## [1] TRUE
## 
## [[18]]
## [1] TRUE
## 
## [[19]]
## [1] TRUE
## 
## [[20]]
## [1] TRUE
## 
## [[21]]
## [1] TRUE
## 
## [[22]]
## [1] TRUE
## 
## [[23]]
## [1] TRUE
## 
## [[24]]
## [1] TRUE
## 
## [[25]]
## [1] TRUE
## 
## [[26]]
## [1] TRUE
## 
## [[27]]
## [1] TRUE

Step 1. GTFS data

# loading MARTA GTFS data
gtfs <- read_gtfs("https://itsmarta.com/google_transit_feed/google_transit.zip")

# 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)


gtfs <- gtfs %>% gtfs_as_sf(crs = 4326)

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()

Step 2. Census data

census_api_key(Sys.getenv("CENSUS_API"), install = FALSE)
## To install your API key for use in future sessions, run this function with `install = TRUE`.
census_raw <- get_acs(
  geography = "tract",
  variables = c(
    hhinc = "B19013_001",      # Median household income
    total_pop = "B02001_001",  # Total population
    white_alone = "B02001_002" # White alone
  ),
  year = 2022,
  state = "GA",
  county = c("Fulton", "DeKalb", "Clayton"),
  geometry = TRUE
)
## Getting data from the 2018-2022 5-year ACS
## Downloading feature geometry from the Census website.  To cache shapefiles for use in future sessions, set `options(tigris_use_cache = TRUE)`.
##   |                                                                              |                                                                      |   0%  |                                                                              |=                                                                     |   1%  |                                                                              |=                                                                     |   2%  |                                                                              |==                                                                    |   2%  |                                                                              |==                                                                    |   3%  |                                                                              |==                                                                    |   4%  |                                                                              |===                                                                   |   5%  |                                                                              |====                                                                  |   5%  |                                                                              |====                                                                  |   6%  |                                                                              |=====                                                                 |   7%  |                                                                              |=====                                                                 |   8%  |                                                                              |======                                                                |   8%  |                                                                              |======                                                                |   9%  |                                                                              |=======                                                               |  10%  |                                                                              |========                                                              |  11%  |                                                                              |========                                                              |  12%  |                                                                              |=========                                                             |  12%  |                                                                              |=========                                                             |  13%  |                                                                              |==========                                                            |  14%  |                                                                              |==========                                                            |  15%  |                                                                              |===========                                                           |  15%  |                                                                              |===========                                                           |  16%  |                                                                              |============                                                          |  17%  |                                                                              |============                                                          |  18%  |                                                                              |=============                                                         |  18%  |                                                                              |=============                                                         |  19%  |                                                                              |==============                                                        |  20%  |                                                                              |==============                                                        |  21%  |                                                                              |===============                                                       |  21%  |                                                                              |===============                                                       |  22%  |                                                                              |================                                                      |  23%  |                                                                              |================                                                      |  24%  |                                                                              |=================                                                     |  24%  |                                                                              |==================                                                    |  25%  |                                                                              |==================                                                    |  26%  |                                                                              |===================                                                   |  26%  |                                                                              |===================                                                   |  27%  |                                                                              |====================                                                  |  28%  |                                                                              |====================                                                  |  29%  |                                                                              |=====================                                                 |  29%  |                                                                              |=====================                                                 |  30%  |                                                                              |======================                                                |  31%  |                                                                              |======================                                                |  32%  |                                                                              |=======================                                               |  32%  |                                                                              |=======================                                               |  33%  |                                                                              |========================                                              |  34%  |                                                                              |========================                                              |  35%  |                                                                              |=========================                                             |  35%  |                                                                              |=========================                                             |  36%  |                                                                              |==========================                                            |  37%  |                                                                              |==========================                                            |  38%  |                                                                              |===========================                                           |  38%  |                                                                              |===========================                                           |  39%  |                                                                              |============================                                          |  40%  |                                                                              |============================                                          |  41%  |                                                                              |=============================                                         |  41%  |                                                                              |=============================                                         |  42%  |                                                                              |==============================                                        |  43%  |                                                                              |===============================                                       |  44%  |                                                                              |===============================                                       |  45%  |                                                                              |================================                                      |  46%  |                                                                              |=================================                                     |  47%  |                                                                              |==================================                                    |  48%  |                                                                              |==================================                                    |  49%  |                                                                              |===================================                                   |  49%  |                                                                              |===================================                                   |  50%  |                                                                              |====================================                                  |  51%  |                                                                              |====================================                                  |  52%  |                                                                              |=====================================                                 |  52%  |                                                                              |=====================================                                 |  53%  |                                                                              |======================================                                |  54%  |                                                                              |======================================                                |  55%  |                                                                              |=======================================                               |  55%  |                                                                              |=======================================                               |  56%  |                                                                              |========================================                              |  57%  |                                                                              |=========================================                             |  58%  |                                                                              |=========================================                             |  59%  |                                                                              |==========================================                            |  60%  |                                                                              |===========================================                           |  61%  |                                                                              |===========================================                           |  62%  |                                                                              |============================================                          |  63%  |                                                                              |=============================================                         |  64%  |                                                                              |=============================================                         |  65%  |                                                                              |==============================================                        |  66%  |                                                                              |===============================================                       |  67%  |                                                                              |===============================================                       |  68%  |                                                                              |================================================                      |  69%  |                                                                              |=================================================                     |  69%  |                                                                              |=================================================                     |  70%  |                                                                              |==================================================                    |  71%  |                                                                              |===================================================                   |  72%  |                                                                              |===================================================                   |  73%  |                                                                              |====================================================                  |  74%  |                                                                              |=====================================================                 |  75%  |                                                                              |=====================================================                 |  76%  |                                                                              |======================================================                |  77%  |                                                                              |=======================================================               |  78%  |                                                                              |=======================================================               |  79%  |                                                                              |========================================================              |  80%  |                                                                              |=========================================================             |  81%  |                                                                              |=========================================================             |  82%  |                                                                              |==========================================================            |  83%  |                                                                              |===========================================================           |  84%  |                                                                              |===========================================================           |  85%  |                                                                              |============================================================          |  86%  |                                                                              |=============================================================         |  87%  |                                                                              |=============================================================         |  88%  |                                                                              |==============================================================        |  88%  |                                                                              |==============================================================        |  89%  |                                                                              |===============================================================       |  90%  |                                                                              |===============================================================       |  91%  |                                                                              |================================================================      |  91%  |                                                                              |================================================================      |  92%  |                                                                              |=================================================================     |  93%  |                                                                              |==================================================================    |  94%  |                                                                              |===================================================================   |  95%  |                                                                              |===================================================================   |  96%  |                                                                              |====================================================================  |  97%  |                                                                              |===================================================================== |  98%  |                                                                              |===================================================================== |  99%  |                                                                              |======================================================================| 100%
census <- census_raw %>%
  select(GEOID, NAME, variable, estimate, geometry) %>%
  st_as_sf() %>%
  st_drop_geometry() %>% 
  pivot_wider(names_from = variable, values_from = estimate) %>%
  mutate(
    pct_minority = 100 * (1 - white_alone / total_pop)
  ) %>%
  select(GEOID, NAME, hhinc, pct_minority) %>%
  # Reattach geometry from census_raw safely
  left_join(st_as_sf(census_raw)[, c("GEOID", "geometry")], by = "GEOID") %>%
  st_as_sf()

# Convert the CRS to GCS (WGS 84)
census <- st_transform(census, crs = 4326)

# Get centroids of Census tract polygons
census_centroids <- census  %>% 
  st_centroid()
## Warning: st_centroid assumes attributes are constant over geometries
 #centroids that fall inside the bbox
home <- census_centroids %>%
  st_filter(bbox, .predicate = st_within)

Step 3. OSM data

# Get OSM road data
osm_road <- opq(bbox = bbox) %>%
    add_osm_feature(key = "highway") %>%
  osmdata_sf() %>% 
  osm_poly2line()
# Ensuring all geometries are LINESTRING
osm <- osm_road$osm_lines %>%
  st_make_valid() %>%                           # fix invalid geometries
  st_cast("LINESTRING", warn = FALSE) %>%       # cast everything to LINESTRING
  filter(st_geometry_type(.) %in% c("LINESTRING", "MULTILINESTRING")) %>%  # keep only lines
  st_cast("LINESTRING", warn = FALSE) %>%       # re-cast MULTILINESTRING to LINESTRING
  filter(!st_is_empty(.))

osm <- as_sfnetwork(osm, directed = FALSE) # Convert to sfnetwork

# Let's simplify our network
osm <- osm %>%
  activate("edges") %>%
  filter(!edge_is_multiple()) %>% # remove multiple edges
  filter(!st_is_empty(geometry)) %>% # removes any invalid edges
  filter(!edge_is_loop()) # remove loops

# Using spatial morpher
osm <- convert(osm, sfnetworks::to_spatial_subdivision)
## Warning: to_spatial_subdivision assumes attributes are constant over geometries
# Change crs for convenience
osm <- osm %<>%
  st_transform(4326) %>% 
  activate("edges") %>% 
  mutate(length = edge_length())

Step 4. Simulate a park-and-ride trip

# Extract the first row from `home` object and store it `home_1`
home_1 <- home[1,]

from_node <- st_nearest_feature(home_1, osm %>% activate("nodes"))
to_node   <- st_nearest_feature(midtown, osm %>% activate("nodes"))

paths <- st_network_paths(osm, from = from_node, to = to_node, weights = osm %>% activate("edges") %>% pull(length), type = "shortest")


# Get shortest 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)
}
# Finding the closest station
closest_idx <- which.min(dist_all)
closest_station <- station[closest_idx, ]

# Calculate total network distance along the path
closest_dist <- sum(
  osm %>%
    activate("nodes") %>%
    slice(paths$node_paths[[1]]) %>%
    st_as_sf("edges") %>%
    pull(length)
)

# Convert 20 miles/hour to meters per minute
speed_m_per_min <- 20 * 1609.34 / 60  # 1 mile = 1609.34 meters

# Calculate travel time in minutes
trvt_osm_m <- closest_dist / speed_m_per_min
# Prepare stop_times for the specific date and time range
am_stop_time <- filter_stop_times(
  gtfs_obj = gtfs,
  extract_date = "2025-11-10",      # your target date
  min_departure_time = 7*3600,      # 7AM in seconds
  max_arrival_time   = 10*3600      # 10AM in seconds
)

# -----------------------------
# Calculate travel times from closest_station to Midtown
trvt <- travel_times(
  filtered_stop_times = am_stop_time,
  stop_name = midtown$stop_name,    # destination
  time_range = 3600,                # 1-hour window
  arrival = FALSE,                  # trips start at origin
  max_transfers = 1,
  return_coords = TRUE
)

# Divide the calculated travel time by 60 to convert the unit from seconds to minutes.
trvt_gtfs_m <- trvt$travel_time/60

# Ensure both are numeric
trvt_gtfs_m <- as.numeric(trvt_gtfs_m)
trvt_osm_m <- as.numeric(trvt_osm_m)

total_trvt <- trvt_osm_m + trvt_gtfs_m

Step 5. Convert Step 4 into a function

get_trvt <- function(home, osm, station, midtown){

  # Extract the first row from `home` object
  home_1 <- home[1,]

  # Find closest nodes in the OSM network
  from_node <- st_nearest_feature(home_1, osm %>% activate("nodes"))
  to_node   <- st_nearest_feature(midtown, osm %>% activate("nodes"))

  # Compute shortest paths along the network
  paths <- st_network_paths(
    osm, 
    from = from_node, 
    to = to_node, 
    weights = osm %>% activate("edges") %>% pull(length), 
    type = "shortest"
  )

  # Compute shortest network distances from home_1 to all 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 closest station
  closest_idx <- which.min(dist_all)
  closest_station <- station[closest_idx, ]

  # Calculate total network distance along the path
  closest_dist <- sum(
    osm %>%
      activate("nodes") %>%
      slice(paths$node_paths[[1]]) %>%
      st_as_sf("edges") %>%
      pull(length)
  )

  # Convert 20 miles/hour to meters per minute
  speed_m_per_min <- 20 * 1609.34 / 60  # 1 mile = 1609.34 meters

  # Calculate travel time in minutes
  trvt_osm_m <- closest_dist / speed_m_per_min

  # Prepare stop_times for the specific date and time range
  am_stop_time <- filter_stop_times(
    gtfs_obj = gtfs,
    extract_date = "2025-11-10",      # your target date
    min_departure_time = 7*3600,      # 7AM in seconds
    max_arrival_time   = 10*3600      # 10AM in seconds
  )

  # Calculate travel times from closest_station to Midtown
  trvt <- travel_times(
    filtered_stop_times = am_stop_time,
    stop_name = midtown$stop_name,    # destination
    time_range = 3600,                # 1-hour window
    arrival = FALSE,                  # trips start at origin
    max_transfers = 1,
    return_coords = TRUE
  )

  # Convert travel time to minutes
  trvt_gtfs_m <- as.numeric(trvt$travel_time / 60)
  trvt_osm_m   <- as.numeric(trvt_osm_m)

  total_trvt <- trvt_osm_m + trvt_gtfs_m
 
  # =========== 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 to all home locations.

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

# Apply the function to 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 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement 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.
## 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 shortest_paths(x, from, to, weights = weights, output = "both", : At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## 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 shortest_paths(x, from, to, weights = weights, output = "both", : At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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 shortest_paths(x, from, to, weights = weights, output = "both", : At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## Stop distance check took longer than 1 second (1.1s). Set stop_dist_check=FALSE to skip it.
## 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.
## 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 shortest_paths(x, from, to, weights = weights, output = "both", : At
## vendor/cigraph/src/paths/dijkstra.c:534 : Couldn't reach some vertices.
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
## 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): number
## of items to replace is not a multiple of replacement length
# cbind the calculated travel time to `home`
home <- home %>% 
  cbind(trvt = total_trvt)

Step 7. Create maps and plots

# Palette for household income (from census polygons)
income_pal <- colorNumeric(
  palette = "YlGnBu",
  domain = census$hhinc,
  na.color = "transparent"
)
# Palette for travel time (from home points)
trvt_pal <- colorNumeric(
  palette = "Reds",
  domain = home$trvt,
  na.color = "transparent"
)

leaflet() %>%
# Add basemap
  addTiles() %>%
# Add Census Tract polygons (income shading)
  addPolygons(
    data = census,
    fillColor = ~income_pal(hhinc),
    fillOpacity = 0.6,
    color = "black",
    weight = 1,
    popup = ~paste0("Median Income: $", formatC(hhinc, format = "f", big.mark = ","))
  ) %>%
  
  # Add Home points (travel time)
  addCircleMarkers(
    data = home,
    radius = 5,
    color = ~trvt_pal(trvt),
    stroke = FALSE,
    fillOpacity = 0.9,
    popup = ~paste0("Travel Time to Midtown: ", round(trvt, 1), " min")
  ) %>%
  
  # Add Legend for Income
  addLegend(
    position = "bottomright",
    pal = income_pal,
    values = census$hhinc,
    title = "Median Household Income",
    opacity = 0.7
  ) %>%
  
  # Add Legend for Travel Time
  addLegend(
    position = "bottomleft",
    pal = trvt_pal,
    values = home$trvt,
    title = "Travel Time to Midtown (min)",
    opacity = 0.7
  )
# Palette for % Minority (from census polygons)
minority_pal <- colorNumeric(
  palette = "PuBuGn",
  domain = census$pct_minority,
  na.color = "transparent"
)
# Palette for Travel Time (from home points)
trvt_pal <- colorNumeric(
  palette = "Reds",
  domain = home$trvt,
  na.color = "transparent"
)

leaflet() %>%
# Add base map tiles
  addTiles() %>%
  
# Add Census polygons shaded by % minority
  addPolygons(
    data = census,
    fillColor = ~minority_pal(pct_minority),
    fillOpacity = 0.6,
    color = "black",
    weight = 1,
    popup = ~paste0(
      "Census Tract: ", NAME, "<br>",
      "% Minority Population: ", round(pct_minority, 1), "%"
    )
  ) %>%
  
  # Add Home points shaded by travel time
  addCircleMarkers(
    data = home,
    radius = 5,
    color = ~trvt_pal(trvt),
    stroke = FALSE,
    fillOpacity = 0.9,
    popup = ~paste0(
      "Travel Time to Midtown: ", round(trvt, 1), " min"
    )
  ) %>%
  
  # Add legend for % Minority
  addLegend(
    position = "bottomright",
    pal = minority_pal,
    values = census$pct_minority,
    title = "% Minority Population",
    opacity = 0.7
  ) %>%
  
  # Add legend for Travel Time
  addLegend(
    position = "bottomleft",
    pal = trvt_pal,
    values = home$trvt,
    title = "Travel Time to Midtown (min)",
    opacity = 0.7
  )
# Ensure both datasets share a spatial relationship
# (Join home points with census polygons)
home_joined <- st_join(home, census, join = st_within)


ggplot(home_joined, aes(x = hhinc.x, y = trvt)) +
  geom_point(alpha = 0.6, color = "#1c9099") +
  geom_smooth(method = "lm", color = "red", se = TRUE) +
  labs(
    title = "Relationship Between Household Income and Travel Time to Midtown Station",
    x = "Median Household Income ($)",
    y = "Travel Time to Midtown (minutes)"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
    axis.title = element_text(size = 12)
  )
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 54 rows containing non-finite outside the scale range
## (`stat_smooth()`).
## Warning: Removed 54 rows containing missing values or values outside the scale range
## (`geom_point()`).

ggplot(home_joined, aes(x = pct_minority.x, y = trvt)) +
  geom_point(alpha = 0.6, color = "#810f7c") +
  geom_smooth(method = "lm", color = "red", se = TRUE) +
  labs(
    title = "Relationship Between Pct minority Pop and Travel Time to Midtown Station",
    x = "percentage of minority population",
    y = "Travel Time to Midtown (minutes)"
  ) +
  theme_minimal() +
  theme(
    plot.title = element_text(face = "bold", size = 14, hjust = 0.5),
    axis.title = element_text(size = 12)
  )
## `geom_smooth()` using formula = 'y ~ x'

Brief Summary description and observations

The map that illustrates the spatial relationship between household income and travel time to MARTA station reveals that higher-income neighborhoods tend to be located closer to Midtown with shorter travel times, while lower-income areas are more peripheral and face longer commutes. The assertion of the illustration of the map is also verified by a scatter plot. The scatter plot revealing the relationship between the median household income and travel time to midtown shows a negative or inverse relationship between the variables. Thus, residents of wealthier neighborhoods experience shorter commutes whiles lower income neighborhoods experience longer travel times.

On the other hand, the map that illustrates the spatial relationship between percentage of minority population and travel time to MARTA station reveals a clear spatial divide in terms of accessibility. Minority communities, concentrated in the southern and western parts of the metropolitan area, experience longer travel times to MARTA stations in contrast to areas with minority populations who benefit from shorter commute times. The scatter plot that relates to the relationship between the percentage of minority population and travel time to midtown shows a positive relationship between the variables. Thus, residents of higher minority neighborhoods experience longer commutes whiles lower minority neighborhoods experience shorter travel times to midtown.