Skip to content

Commit

Permalink
Force read ids in stops.txt as character
Browse files Browse the repository at this point in the history
  • Loading branch information
mem48 committed Jul 17, 2023
1 parent 761cf65 commit 238c1e3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/gtfs_merge.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ gtfs_merge <- function(gtfs_list, force = FALSE, quiet = TRUE) {
calendar <- sapply(gtfs_list, "[", "calendar")
calendar_dates <- sapply(gtfs_list, "[", "calendar_dates")

# bind togther
# bind together
names(agency) <- seq(1, length(agency))
suppressWarnings(agency <- dplyr::bind_rows(agency, .id = "file_id"))

Expand Down Expand Up @@ -77,7 +77,7 @@ gtfs_merge <- function(gtfs_list, force = FALSE, quiet = TRUE) {
agency <- unique(agency)
if (any(duplicated(agency$agency_id))) {
# Check for upppercase problems
# Sometime same agency with a captial letter in the name
# Sometime same agency with a capital letter in the name
agency.check <- agency
agency.check$agency_name <- tolower(agency.check$agency_name)
agency.check <- unique(agency.check)
Expand Down
10 changes: 9 additions & 1 deletion R/gtfs_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,15 @@ gtfs_read <- function(path){
}

if(checkmate::test_file_exists(file.path(tmp_folder,"stops.txt"))){
gtfs$stops <- readr::read_csv(file.path(tmp_folder,"stops.txt"), lazy = FALSE, show_col_types = FALSE)
gtfs$stops <- readr::read_csv(file.path(tmp_folder,"stops.txt"),
col_types = readr::cols(stop_id = readr::col_character(),
stop_code = readr::col_character(),
stop_name = readr::col_character(),
stop_lat = readr::col_number(),
stop_lon = readr::col_number()),


lazy = FALSE, show_col_types = FALSE)
} else {
warning("Unable to find required file: stops.txt")
}
Expand Down
2 changes: 1 addition & 1 deletion R/nptdr_export.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ nptdr_makeCalendar <- function(schedule, exceptions, historic_bank_holidays = hi
calendar_dates <- nptdr_parse_bank_holidays(calendar_dates, bh)
calendar_dates <- rbind(calendar_dates, cal_dates_exc, cal_dates_inc)

# TODO: Historical term times
# Historical term times
data("school_terms")
message("School term dates are illustrative and not exact")

Expand Down

0 comments on commit 238c1e3

Please sign in to comment.