Skip to content

Commit

Permalink
Fix #270
Browse files Browse the repository at this point in the history
  • Loading branch information
Robinlovelace committed Sep 18, 2018
1 parent 5e1a2f7 commit 7d6745a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions R/load-stats19.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#' @examples
#' \dontrun{
#' dl_stats19()
#'
#'
#' # Load all stats19 datasets
#' ac <- read_stats19_ac()
#' ca <- read_stats19_ca()
Expand Down Expand Up @@ -61,7 +61,16 @@ read_stats19_ac <- function(data_dir = tempdir(), filename = "Accidents0514.csv"
}

# read the data in
ac <- readr::read_csv(file.path(data_dir, "Accidents0514.csv"))
ac <- readr::read_csv(file.path(data_dir, "Accidents0514.csv"), col_types = readr::cols(
.default = readr::col_integer(),
Accident_Index = readr::col_character(),
Longitude = readr::col_double(),
Latitude = readr::col_double(),
Date = readr::col_character(),
Time = readr::col_character(),
`Local_Authority_(Highway)` = readr::col_character(),
LSOA_of_Accident_Location = readr::col_character()
))
# ve <- readr::read_csv(file.path(data_dir, "Vehicles0514.csv"))
# ca <- readr::read_csv(file.path(data_dir, "Casualties0514.csv"))

Expand Down Expand Up @@ -146,9 +155,6 @@ format_stats19_ac <- function(ac) {
"Frost or ice", "Flood over 3cm. deep"
)
)
ac$Time <-
lubridate::hm(ac$Time)
# hist(ac$Time@hour) # verify times
ac$Date <- lubridate::dmy(ac$Date)
# barplot(table(lubridate::wday(ac$Date, label = TRUE)))

Expand Down

0 comments on commit 7d6745a

Please sign in to comment.