Skip to content

Commit

Permalink
streamline documentation and compact data
Browse files Browse the repository at this point in the history
  • Loading branch information
s87jackson committed Feb 15, 2024
1 parent d3754c9 commit a51a478
Show file tree
Hide file tree
Showing 122 changed files with 71,026 additions and 7,841 deletions.
7 changes: 4 additions & 3 deletions CRAN-SUBMISSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
Version: 0.3.0
Date: 2023-05-04 15:05:08 UTC
SHA: c5c0326f6b0f824f5d72ff471a4363e15cd592d6
Version: 0.3.1
Date: 2024-02-13 22:32:17 UTC
SHA:
d3754c9462a9990393f3bafe2a37cf25514ad030
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: rfars
Type: Package
Title: Download and Analyze Crash Data
Version: 0.3.1
Version: 1.1.0
Authors@R: person("Steve", "Jackson",
email="steve.jackson@toxcel.com",
role = c("aut", "cre"),
Expand Down
6 changes: 6 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# rfars 1.1.0

* Streamlined the README content
* Cleaned up the vignettes
* Incremented the version number to communicate the end of the beta testing stage

# rfars 0.3.1

* Adjusted code to account for file structure changes by data provider
Expand Down
13 changes: 3 additions & 10 deletions R/compare_counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,12 @@
#' @return A tibble of counts.
#'
#' @examples
#' \donttest{
#' get_fars(years = 2020, states="Virginia") %>%
#' compare_counts(
#' compare_counts(
#' get_fars(years = 2020, states="Virginia"),
#' where = list(urb="rural"),
#' where2 = list(urb="urban")
#' )
#'
#' get_fars(years = 2020, states="FL") %>%
#' compare_counts(
#' involved = "pedestrians",
#' involved2 = "bicyclists"
#' )
#' }




Expand Down
11 changes: 2 additions & 9 deletions R/counts.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,8 @@
#' @importFrom rlang .data
#'
#' @examples
#' \donttest{
#'
#' get_fars(years = 2020) %>%
#' counts(where = list(states="Virginia", urb="rural"))
#'
#' get_fars(years = 2020) %>%
#' counts(where=list(states="FL"), involved = "older driver")
#'
#' }
#' counts(get_fars(years = 2020), where = list(states="Virginia", urb="rural"))



counts <- function(df,
Expand Down
4 changes: 2 additions & 2 deletions R/data.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#' @format A data frame with 132,454 rows and 8 variables:
#' \describe{
#' \item{source}{The source of the data (either FARS or GES/CRSS)}
#' \item{year}{Year of the data element definition.}
#' \item{years}{Years of the data element definition.}
#' \item{file}{The data file that contains the given variable.}
#' \item{name_ncsa}{The original name of the data element.}
#' \item{name_rfars}{The modified data element name used in rfars}
Expand Down Expand Up @@ -80,7 +80,7 @@
#' @format A data frame with 85,907 rows and 8 variables:
#' \describe{
#' \item{source}{The source of the data (either FARS or GESCRSS)}
#' \item{year}{Year of the data element definition.}
#' \item{years}{Years of the data element definition.}
#' \item{file}{The data file that contains the given variable.}
#' \item{name_ncsa}{The original name of the data element.}
#' \item{name_rfars}{The modified data element name used in rfars}
Expand Down
6 changes: 2 additions & 4 deletions R/get_fars.R
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,8 @@
#'
#'
#' @examples
#' \donttest{
#' myFARS <- get_fars(years = 2019:2021, states = "51")
#' myFARS <- get_fars(years = 2021, states = "NC")
#' }
#' myFARS <- get_fars(years = 2021, states = "VA")


get_fars <- function(years = 2011:2021,
states = NULL,
Expand Down
5 changes: 1 addition & 4 deletions R/get_gescrss.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@
#'
#'
#' @examples
#' \donttest{
#' myGESCRSS <- get_gescrss(years = 2019:2021, regions = "s")
#' myGESCRSS <- get_gescrss(years = 2021)
#' }
#' myGESCRSS <- get_gescrss(years = 2021, regions = "s")

get_gescrss <- function(years = 2011:2021,
regions = c("mw", "ne", "s", "w"),
Expand Down
8 changes: 4 additions & 4 deletions R/use_gescrss.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ use_gescrss <- function(dir, prepared_dir, cache){

flat <-

#suppressWarnings({ #this is just for the small number of coercion errors with mutate_at(lat, lon, as.numeric)
suppressWarnings({ #this is just for the small number of coercion errors with mutate_at(lat, lon, as.numeric)

#suppressMessages({
suppressMessages({

data.frame(path = list.files(path = prepared_dir, full.names = TRUE, pattern = "_flat.rds", recursive = TRUE)) %>%
mutate(year = stringr::word(.data$path, -1, sep = "/") %>% substr(1,4)) %>%
Expand All @@ -28,9 +28,9 @@ use_gescrss <- function(dir, prepared_dir, cache){
readr::type_convert() %>%
distinct()

#})
})

#})
})


multi_acc <- import_multi("multi_acc.rds", where = prepared_dir) #%>% distinct()
Expand Down
Loading

0 comments on commit a51a478

Please sign in to comment.