Skip to content

Commit

Permalink
use old readr on windows
Browse files Browse the repository at this point in the history
see #205
  • Loading branch information
agila5 committed Jul 20, 2021
1 parent 8a11e8d commit 23e61a1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions R/read.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ read_accidents = function(year = NULL,
data_dir = get_data_directory(),
format = TRUE,
silent = FALSE) {
# Set the local edition for readr.
# See https://github.com/ropensci/stats19/issues/205
if (.Platform$OS.type == "windows" && utils::packageVersion("readr") >= "2.0.0") {
readr::local_edition(1)
}

path = check_input_file(
filename = filename,
type = "accidents",
Expand Down Expand Up @@ -163,6 +169,12 @@ check_input_file = function(filename = NULL,
# path = file.path(get_data_directory(), f)
# read_ve_ca(path)
read_ve_ca = function(path) {
# Set the local edition for readr.
# See https://github.com/ropensci/stats19/issues/205
if (.Platform$OS.type == "windows" && utils::packageVersion("readr") >= "2.0.0") {
readr::local_edition(1)
}

h = utils::read.csv(path, nrows = 1)
if(grepl("Accident_Index", names(h)[1])) {
readr::read_csv(path, col_types = readr::cols(
Expand Down

0 comments on commit 23e61a1

Please sign in to comment.