Skip to content

Commit

Permalink
updated vignette
Browse files Browse the repository at this point in the history
  • Loading branch information
tmss1 committed Jul 5, 2022
1 parent 704e869 commit 58a3b3a
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions R/fars_functions_W4.R
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ fars_read_years <- function(years) {
#'
#' @note An error will occur if the file does not exist in the working directory.
#'
#' @importFrom dplyr bind_rows group_by
#' @importFrom dplyr bind_rows group_by summarize n
#' @importFrom tidyr spread
#' @importFrom magrittr `%>%`
#'
Expand All @@ -100,7 +100,7 @@ fars_summarize_years <- function(years) {
dat_list <- fars_read_years(years)
dplyr::bind_rows(dat_list) %>%
dplyr::group_by(year, MONTH) %>%
dplyr::summarize(n = n()) %>%
dplyr::summarize(n = dplyr::n()) %>%
tidyr::spread(year, n)
}

Expand Down
Binary file added vignettes/accident_2013.csv.bz2
Binary file not shown.
Binary file added vignettes/accident_2014.csv.bz2
Binary file not shown.
Binary file added vignettes/accident_2015.csv.bz2
Binary file not shown.
7 changes: 3 additions & 4 deletions vignettes/make_filename.Rmd → vignettes/fars_vignette.Rmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: "make_filename"
title: "fars_vignette"
output: rmarkdown::html_vignette
vignette: >
%\VignetteIndexEntry{make_filename}
Expand All @@ -14,10 +14,9 @@ knitr::opts_chunk$set(
)
```

The `make_filename` function creates an "accident_year.csv.bz2" file name given the year entered by the user.
The `fars_summarize_years` accepts a vector of years of the data requested and summaries the number of accidents by month and year.

```{r setup}
library(fars)
fname <- make_filename(2015)
fname
d <- fars_summarize_years(c(2013,2014,2015))
```

0 comments on commit 58a3b3a

Please sign in to comment.