Skip to content

Commit

Permalink
Document new data
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcaseb committed Oct 31, 2024
1 parent a9ffafd commit 54f8c50
Show file tree
Hide file tree
Showing 7 changed files with 77 additions and 9 deletions.
26 changes: 23 additions & 3 deletions R/data_doc.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,27 @@
#' `nflfastR` package. Please see `data-raw/divisions.R` for the code to create
#' this data.
#' @examples
#' \donttest{
#' divisions
#' }
#' str(divisions)
"divisions"

#' Example Games Data used in NFL Simulations
#'
#' @docType data
#' @format A data frame with 284 rows and 9 variables containing NFL schedule
#' information.
#' @details
#' Please see `data-raw/sim_examples.R` for the code to create this data.
#' @examples
#' str(sims_games_example)
"sims_games_example"

#' Example Teams Data used in NFL Simulations
#'
#' @docType data
#' @format A data frame with 64 rows and 5 variables containing team name and
#' division information.
#' @details
#' Please see `data-raw/sim_examples.R` for the code to create this data.
#' @examples
#' str(sims_teams_example)
"sims_teams_example"
8 changes: 6 additions & 2 deletions data-raw/sim_examples.R
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
sims_teams_example <- nflseedR::divisions |>
dplyr::filter(!team %in% c("LAR", "STL", "SD", "OAK"))
dplyr::filter(!team %in% c("LAR", "STL", "SD", "OAK")) |>
strip_nflverse_attributes() |>
tibble::as_tibble()
sims_teams_example <- sims_teams_example[rep(seq_len(nrow(sims_teams_example)), 2), ] |>
dplyr::mutate(sim = rep(1:2, each = nrow(sims_teams_example))) |>
select(sim, dplyr::everything())
Expand All @@ -18,7 +20,9 @@ sims_games_example <- sims_games_example |>
result = data.table::fifelse(game_id %in% reset_ids, NA_integer_, result),
result = data.table::fifelse(game_type == "SB", NA_integer_, result)
) |>
dplyr::select(-"game_id")
dplyr::select(-"game_id") |>
strip_nflverse_attributes() |>
tibble::as_tibble()

usethis::use_data(sims_teams_example, sims_games_example, overwrite = TRUE)

Expand Down
Binary file modified data/sims_games_example.rda
Binary file not shown.
4 changes: 1 addition & 3 deletions man/divisions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/nfl_simulations.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions man/sims_games_example.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions man/sims_teams_example.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 54f8c50

Please sign in to comment.