-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,9 +29,9 @@ read_accidents = function(year = NULL, | |
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) | ||
} | ||
# if (.Platform$OS.type == "windows" && utils::packageVersion("readr") >= "2.0.0") { | ||
# readr::local_edition(1) | ||
# } | ||
|
||
path = check_input_file( | ||
filename = filename, | ||
|
@@ -56,7 +56,8 @@ read_accidents = function(year = NULL, | |
Time = readr::col_character(), | ||
`Local_Authority_(Highway)` = readr::col_character(), | ||
LSOA_of_Accident_Location = readr::col_character() | ||
) | ||
), | ||
lazy = FALSE | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
agila5
Author
Collaborator
|
||
) | ||
}) | ||
|
||
|
@@ -171,21 +172,21 @@ check_input_file = function(filename = NULL, | |
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) | ||
} | ||
# 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( | ||
.default = readr::col_integer(), | ||
Accident_Index = readr::col_character() | ||
)) | ||
), lazy = FALSE) | ||
} else { | ||
x = readr::read_csv(path, col_types = readr::cols( | ||
.default = readr::col_integer(), | ||
Acc_Index = readr::col_character() | ||
)) | ||
), lazy = FALSE) | ||
names(x)[names(x) == "Acc_Index"] = "Accident_Index" | ||
x | ||
} | ||
|
Did the test work? Could be useful with reference to tidyverse/readr#1266, will be worth thinking about +s and -s of different options but
lazy=FALSE
sounds less invasive and more consistent between OSs.