Rows: 3744 Columns: 29
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (10): Agency, City, State, NTD ID, Organization Type, Reporter Type, UZA...
dbl (2): Report Year, UACE Code
num (10): Primary UZA Population, Agency VOMS, Mode VOMS, Vehicle Operations...
lgl (7): Vehicle Operations Questionable, Vehicle Maintenance Questionable,...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
`summarise()` has grouped output by 'NTD ID'. You can override using the `.groups` argument.
Combine FARES and EXPENSES datasets
FINANCIALS <-inner_join(FARES, EXPENSES, by =c("NTD ID", "Mode"))
Download Monthly Transit Numbers (Ridership)
if (!file.exists("ridership.xlsx")) {download.file("https://www.transit.dot.gov/sites/fta.dot.gov/files/2024-09/July%202024%20Complete%20Monthly%20Ridership%20%28with%20adjustments%20and%20estimates%29_240903.xlsx", destfile ="ridership.xlsx", quiet =FALSE, method ="wget")}
Prepare Trips (UPT) Data
TRIPS <-read_xlsx("ridership.xlsx", sheet ="UPT") %>%filter(`Mode/Type of Service Status`=="Active") %>%select(-`Legacy NTD ID`, -`Reporter Type`, -`Mode/Type of Service Status`, -`UACE CD`, -`TOS`) %>%pivot_longer(-c(`NTD ID`:`3 Mode`), names_to ="month", values_to ="UPT") %>%drop_na()
Prepare Mileage (VRM) Data
MILES <-read_xlsx("ridership.xlsx", sheet ="VRM") %>%filter(`Mode/Type of Service Status`=="Active") %>%select(-`Legacy NTD ID`, -`Reporter Type`, -`Mode/Type of Service Status`, -`UACE CD`, -`TOS`) %>%pivot_longer(-c(`NTD ID`:`3 Mode`), names_to ="month", values_to ="VRM") %>%drop_na() %>%group_by(`NTD ID`, `Agency`, `UZA Name`, `Mode`, `3 Mode`, month) %>%summarize(VRM =sum(VRM, na.rm =TRUE)) %>%ungroup()
`summarise()` has grouped output by 'NTD ID', 'Agency', 'UZA Name', 'Mode', '3
Mode'. You can override using the `.groups` argument.
ridership_fall <- nyc_subway_april_2019$Total_Trips_2019 - nyc_subway_april_2020$Total_Trips_2020print(paste("Ridership fall between April 2019 and April 2020:", ridership_fall))
[1] "Ridership fall between April 2019 and April 2020: 0"
`summarise()` has grouped output by 'Agency'. You can override using the
`.groups` argument.
Warning: There was 1 warning in `filter()`.
ℹ In argument: `Total_UPT == max(Total_UPT, na.rm = TRUE)`.
Caused by warning in `max()`:
! no non-missing arguments to max; returning -Inf