From 51acee7cc8d40542e62a99baf8f18e467ad46da9 Mon Sep 17 00:00:00 2001 From: Tan Ho Date: Tue, 8 Aug 2023 11:37:56 -0400 Subject: [PATCH] add to docs --- R/from_url.R | 6 ++++++ R/load_combine.R | 1 + R/load_contracts.R | 1 + R/load_depth_charts.R | 1 + R/load_draft_picks.R | 1 + R/load_espn_qbr.R | 1 + R/load_ffverse.R | 1 + R/load_injuries.R | 1 + R/load_nextgen_stats.R | 1 + R/load_officials.R | 1 + R/load_participation.R | 1 + R/load_pbp.R | 1 + R/load_pfr_advstats.R | 2 ++ R/load_player_stats.R | 1 + R/load_players.R | 1 + R/load_rosters.R | 1 + R/load_rosters_weekly.R | 1 + R/load_schedules.R | 1 + R/load_snap_counts.R | 1 + R/load_teams.R | 3 ++- R/load_trades.R | 1 + R/utils.R | 1 - R/utils_cran.R | 1 + R/utils_download_nflverse.R | 19 ++++++++++++------- R/utils_gameid.R | 1 + R/utils_join_coalesce.R | 2 +- R/utils_name_cleaning.R | 22 +++++++++++----------- R/utils_progressively.R | 2 +- R/utils_sitrep.R | 1 + man/clean_homeaway.Rd | 19 +++++++++---------- man/clean_player_names.Rd | 2 +- man/clean_team_abbrs.Rd | 1 + man/csv_from_url.Rd | 1 + man/dot-for_cran.Rd | 1 + man/join_coalesce.Rd | 2 +- man/load_combine.Rd | 1 + man/load_contracts.Rd | 1 + man/load_depth_charts.Rd | 1 + man/load_draft_picks.Rd | 1 + man/load_espn_qbr.Rd | 1 + man/load_ff_playerids.Rd | 1 + man/load_from_url.Rd | 1 + man/load_injuries.Rd | 1 + man/load_nextgen_stats.Rd | 1 + man/load_officials.Rd | 1 + man/load_participation.Rd | 1 + man/load_pbp.Rd | 1 + man/load_pfr_advstats.Rd | 1 + man/load_pfr_passing.Rd | 1 + man/load_player_stats.Rd | 1 + man/load_players.Rd | 1 + man/load_rosters.Rd | 1 + man/load_rosters_weekly.Rd | 1 + man/load_schedules.Rd | 1 + man/load_snap_counts.Rd | 1 + man/load_teams.Rd | 1 + man/load_trades.Rd | 1 + man/nflverse_download.Rd | 3 +-- man/nflverse_game_id.Rd | 1 + man/nflverse_releases.Rd | 9 +++++++-- man/parquet_from_url.Rd | 1 + man/progressively.Rd | 2 +- man/qs_from_url.Rd | 1 + man/raw_from_url.Rd | 1 + man/rds_from_url.Rd | 1 + man/sitrep.Rd | 1 + tests/testthat/setup.R | 0 67 files changed, 107 insertions(+), 39 deletions(-) create mode 100644 tests/testthat/setup.R diff --git a/R/from_url.R b/R/from_url.R index dba5f4d6..0c6d0e2b 100644 --- a/R/from_url.R +++ b/R/from_url.R @@ -10,6 +10,7 @@ #' @return a dataframe, possibly of type `nflverse_data` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' urls <- c("https://github.com/nflverse/nflverse-data/releases/download/rosters/roster_2020.csv", @@ -48,6 +49,7 @@ load_from_url <- function(url, ..., seasons = TRUE, nflverse = FALSE){ #' @return a dataframe as created by [`readRDS()`] #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' rds_from_url("https://github.com/nflverse/nflverse-data/releases/download/test/combines.rds") @@ -80,6 +82,7 @@ rds_from_url <- function(url) { #' @return a dataframe as created by [`data.table::fread()`] #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' csv_from_url("https://github.com/nflverse/nflverse-data/releases/download/test/combines.csv") @@ -102,6 +105,7 @@ csv_from_url <- function(...){ #' @return a raw vector #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents CRAN errors #' head(raw_from_url( @@ -138,6 +142,7 @@ raw_from_url <- function(url){ #' @return a dataframe as parsed by [`arrow::read_parquet()`] #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ #' parquet_from_url( @@ -175,6 +180,7 @@ parquet_from_url <- function(url){ #' @return a dataframe as parsed by [`qs::qdeserialize()`] #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ #' qs_from_url( diff --git a/R/load_combine.R b/R/load_combine.R index d37b1dbc..a9f5e841 100644 --- a/R/load_combine.R +++ b/R/load_combine.R @@ -6,6 +6,7 @@ #' @param file_type One of `c("rds", "qs", "csv", "parquet")`. Can also be set globally with #' `options(nflreadr.prefer)` #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_combine() diff --git a/R/load_contracts.R b/R/load_contracts.R index 5e633c64..9aad16b5 100644 --- a/R/load_contracts.R +++ b/R/load_contracts.R @@ -6,6 +6,7 @@ #' Can also be set globally with options(nflreadr.prefer) #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_contracts() diff --git a/R/load_depth_charts.R b/R/load_depth_charts.R index f2a12b3d..340dc79b 100644 --- a/R/load_depth_charts.R +++ b/R/load_depth_charts.R @@ -7,6 +7,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_depth_charts(2020) diff --git a/R/load_draft_picks.R b/R/load_draft_picks.R index 6eadbfbc..8d168955 100644 --- a/R/load_draft_picks.R +++ b/R/load_draft_picks.R @@ -7,6 +7,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_draft_picks() diff --git a/R/load_espn_qbr.R b/R/load_espn_qbr.R index 04c44c64..39d9747a 100644 --- a/R/load_espn_qbr.R +++ b/R/load_espn_qbr.R @@ -5,6 +5,7 @@ #' @param summary_type One of "season" or "weekly", defaults to season #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' load_espn_qbr("nfl",2020) #' } diff --git a/R/load_ffverse.R b/R/load_ffverse.R index a25a6ef4..3bc20055 100644 --- a/R/load_ffverse.R +++ b/R/load_ffverse.R @@ -5,6 +5,7 @@ #' @return a dataframe of player IDs #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_ff_playerids() diff --git a/R/load_injuries.R b/R/load_injuries.R index 3f7bca95..0bd4a08c 100644 --- a/R/load_injuries.R +++ b/R/load_injuries.R @@ -7,6 +7,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({# prevents cran errors #' load_injuries(2020) diff --git a/R/load_nextgen_stats.R b/R/load_nextgen_stats.R index 7c61d57a..0bb19848 100644 --- a/R/load_nextgen_stats.R +++ b/R/load_nextgen_stats.R @@ -12,6 +12,7 @@ #' #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_nextgen_stats(stat_type = "passing") diff --git a/R/load_officials.R b/R/load_officials.R index 875d7145..29819be2 100644 --- a/R/load_officials.R +++ b/R/load_officials.R @@ -7,6 +7,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_officials() diff --git a/R/load_participation.R b/R/load_participation.R index aa58c3a6..8be9dbf0 100644 --- a/R/load_participation.R +++ b/R/load_participation.R @@ -10,6 +10,7 @@ #' @return A dataframe of participation data, optionally merged with play by play #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_participation(seasons = 2020, include_pbp = TRUE) diff --git a/R/load_pbp.R b/R/load_pbp.R index 1a882154..4e549a26 100644 --- a/R/load_pbp.R +++ b/R/load_pbp.R @@ -10,6 +10,7 @@ #' (see below) for all given `seasons` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_pbp(2019:2020) diff --git a/R/load_pfr_advstats.R b/R/load_pfr_advstats.R index 474172e4..a4a278be 100644 --- a/R/load_pfr_advstats.R +++ b/R/load_pfr_advstats.R @@ -6,6 +6,7 @@ #' @param seasons a numeric vector specifying what seasons to return, if `TRUE` returns all available data #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' load_pfr_passing() #' } @@ -38,6 +39,7 @@ load_pfr_passing <- function(seasons = TRUE){ #' #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_pfr_advstats() diff --git a/R/load_player_stats.R b/R/load_player_stats.R index d1cc37bb..b1c69e38 100644 --- a/R/load_player_stats.R +++ b/R/load_player_stats.R @@ -6,6 +6,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_player_stats() diff --git a/R/load_players.R b/R/load_players.R index 6ef346f1..71ad6173 100644 --- a/R/load_players.R +++ b/R/load_players.R @@ -5,6 +5,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_players() diff --git a/R/load_rosters.R b/R/load_rosters.R index 85fbebcc..11b0c68f 100644 --- a/R/load_rosters.R +++ b/R/load_rosters.R @@ -7,6 +7,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_rosters(2020) diff --git a/R/load_rosters_weekly.R b/R/load_rosters_weekly.R index 486a0853..cff65782 100644 --- a/R/load_rosters_weekly.R +++ b/R/load_rosters_weekly.R @@ -9,6 +9,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_rosters_weekly(2020) diff --git a/R/load_schedules.R b/R/load_schedules.R index e0576cb5..b57c8091 100644 --- a/R/load_schedules.R +++ b/R/load_schedules.R @@ -11,6 +11,7 @@ #' @seealso Issues with this data should be filed here: #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_schedules(2020) diff --git a/R/load_snap_counts.R b/R/load_snap_counts.R index f212e1fa..e541500a 100644 --- a/R/load_snap_counts.R +++ b/R/load_snap_counts.R @@ -8,6 +8,7 @@ #' `options(nflreadr.prefer)` #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents CRAN errors #' load_snap_counts() diff --git a/R/load_teams.R b/R/load_teams.R index 67402952..c47efa9a 100644 --- a/R/load_teams.R +++ b/R/load_teams.R @@ -2,9 +2,10 @@ #' #' @description Loads team graphics, colors, and logos - useful for plots! #' -#' @param current If `TRUE` (the default), returns a standardized list of current teams only, +#' @param current If `TRUE` (the default), returns a standardized list of current teams only, #' with abbreviations as per [nflreadr::team_abbr_mapping]. #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' load_teams() diff --git a/R/load_trades.R b/R/load_trades.R index d495bbb3..2561bc57 100644 --- a/R/load_trades.R +++ b/R/load_trades.R @@ -11,6 +11,7 @@ #' @seealso Issues with this data should be filed here: #' #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' load_trades(2020) #' } diff --git a/R/utils.R b/R/utils.R index 820fa977..90460b1d 100644 --- a/R/utils.R +++ b/R/utils.R @@ -35,7 +35,6 @@ print.nflverse_data <- function(x,...){ #' @export #' @keywords internal rbindlist_with_attrs <- function(dflist){ - nflverse_timestamp <- attr(dflist[[length(dflist)]], "nflverse_timestamp") nflverse_type <- attr(dflist[[length(dflist)]], "nflverse_type") out <- data.table::rbindlist(dflist, use.names = TRUE, fill = TRUE) diff --git a/R/utils_cran.R b/R/utils_cran.R index de19d43e..ee5a2db0 100644 --- a/R/utils_cran.R +++ b/R/utils_cran.R @@ -4,6 +4,7 @@ #' limiting data.table CPU cores for examples/tests #' #' @export +#' @keywords internal .for_cran <- function(){ cores <- min( diff --git a/R/utils_download_nflverse.R b/R/utils_download_nflverse.R index 88bfd8d6..32c3416c 100644 --- a/R/utils_download_nflverse.R +++ b/R/utils_download_nflverse.R @@ -13,7 +13,8 @@ #' @param use_hive whether to create hive-style partition folders for each season, e.g. `"~/pbp/.season=2021/pbp.csv"` #' @param .token a GitHub API token, `"default"` uses `gh::gh_token()` #' -#' @examples { +#' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ #' ## could also set options like @@ -24,7 +25,6 @@ #' list.files(tempdir(),pattern = ".parquet$") # check that files were downloaded! #' }) #' } -#' } #' @export nflverse_download <- function(..., folder_path = getOption("nflreadr.download_path", default = "."), @@ -115,21 +115,26 @@ nflverse_download <- function(..., #' #' @param .token a GitHub API token, `"default"` uses `gh::gh_token()` #' -#' @return A dataframe containing release names, release descriptions, and -#' other relevant release information. -#' @export #' @examples -#' \donttest{ +#' \dontshow{ +#' .for_cran() #' # Change option for better output #' old <- options(piggyback.verbose = FALSE) +#' } +#' \donttest{ #' #' try( # avoids cran failures, can skip in normal usage #' nflverse_releases() #' ) -#' +#' } +#' \dontshow{ #' # Restore old options #' options(old) #' } +#' +#' @return A dataframe containing release names, release descriptions, and +#' other relevant release information. +#' @export nflverse_releases <- function(.token = "default") { rlang::check_installed("piggyback (>= 0.1.2)", "gh") if(.token == "default") .token <- gh::gh_token() diff --git a/R/utils_gameid.R b/R/utils_gameid.R index d35d401a..f7120682 100644 --- a/R/utils_gameid.R +++ b/R/utils_gameid.R @@ -8,6 +8,7 @@ #' @export #' #' @examples +#' \dontshow{.for_cran()} #' nflverse_game_id(2022, 2, "LAC", "KC") nflverse_game_id <- function(season, week, diff --git a/R/utils_join_coalesce.R b/R/utils_join_coalesce.R index 9f5de07e..ce7f197f 100644 --- a/R/utils_join_coalesce.R +++ b/R/utils_join_coalesce.R @@ -18,7 +18,7 @@ #' #' #' @examples -#' +#' \dontshow{.for_cran()} #' x <- data.frame(id1 = c(NA_character_,letters[1:4]), a = c(1,NA,3,NA,5), b = 1:5 * 10) #' y <- data.frame(id2 = c(letters[3:11],NA_character_), a = -(1:10), c = 1:10 * 100) #' diff --git a/R/utils_name_cleaning.R b/R/utils_name_cleaning.R index 9e9a3174..c9278a7c 100644 --- a/R/utils_name_cleaning.R +++ b/R/utils_name_cleaning.R @@ -16,6 +16,7 @@ #' with `NA` (depending on the value of `keep_non_matches`). #' @export #' @examples +#' \dontshow{.for_cran()} #' x <- c("PIE", "LAR", "PIT", "CRD", "OAK", "SL") #' # use current location and keep non matches #' clean_team_abbrs(x) @@ -60,7 +61,7 @@ clean_team_abbrs <- function(abbr, current_location = TRUE, keep_non_matches = T #' @return a character vector of cleaned names #' #' @examples -#' +#' \dontshow{.for_cran()} #' clean_player_names(c("A.J. Green", "Odell Beckham Jr. ", "Le'Veon Bell Sr.")) #' #' clean_player_names(c("Trubisky, Mitch", "Atwell, Chatarius", "Elliott, Zeke", "Elijah Moore"), @@ -117,22 +118,21 @@ clean_player_names <- function(player_name, #' @param invert a character vector of columns that gets inverted when referring to the away team (e.g. home spread = 1 gets converted to away_spread = -1) #' #' @examples -#' \donttest{ +#' \dontshow{.for_cran()} #' # a small example dataframe #' s <- data.frame( -#' game_id = c("2020_20_TB_GB", "2020_20_BUF_KC", "2020_21_KC_TB"), -#' game_type = c("CON", "CON", "SB"), -#' away_team = c("TB", "BUF", "KC"), -#' away_score = c(31L, 24L, 9L), -#' home_team = c("GB", "KC", "TB"), -#' home_score = c(26L, 38L, 31L), -#' location = c("Home", "Home", "Neutral"), -#' result = c(-5L, 14L, 22L), +#' game_id = c("2020_20_TB_GB", "2020_20_BUF_KC", "2020_21_KC_TB"), +#' game_type = c("CON", "CON", "SB"), +#' away_team = c("TB", "BUF", "KC"), +#' away_score = c(31L, 24L, 9L), +#' home_team = c("GB", "KC", "TB"), +#' home_score = c(26L, 38L, 31L), +#' location = c("Home", "Home", "Neutral"), +#' result = c(-5L, 14L, 22L), #' spread_line = c(3, 3, -3) #' ) #' #' clean_homeaway(s, invert = c("result","spread_line")) -#' } #' @return a dataframe with one row per team (twice as long as the input dataframe) #' @export clean_homeaway <- function(dataframe, invert = NULL){ diff --git a/R/utils_progressively.R b/R/utils_progressively.R index 001af077..52beddc1 100644 --- a/R/utils_progressively.R +++ b/R/utils_progressively.R @@ -8,7 +8,7 @@ #' @param p a function such as one created by `progressr::progressor()` - also accepts purrr-style lambda functions. #' #' @examples -#' +#' \dontshow{.for_cran()} #' \donttest{ #' try({ # prevents cran errors #' diff --git a/R/utils_sitrep.R b/R/utils_sitrep.R index 57da6202..0cf223e6 100644 --- a/R/utils_sitrep.R +++ b/R/utils_sitrep.R @@ -20,6 +20,7 @@ #' @param redact_path a logical indicating whether options that contain "path" #' in the name should be redacted, default = TRUE #' @examples +#' \dontshow{.for_cran()} #' \donttest{ #' try({ #' nflverse_sitrep() diff --git a/man/clean_homeaway.Rd b/man/clean_homeaway.Rd index f51e9c6e..0583043a 100644 --- a/man/clean_homeaway.Rd +++ b/man/clean_homeaway.Rd @@ -18,20 +18,19 @@ a dataframe with one row per team (twice as long as the input dataframe) This function converts dataframes with "home_" and "away_" prefixed columns to "team_" and "opponent_", and doubles the rows. This makes sure that there's one row for each team (as opposed to one row for each game). } \examples{ -\donttest{ +\dontshow{.for_cran()} # a small example dataframe s <- data.frame( - game_id = c("2020_20_TB_GB", "2020_20_BUF_KC", "2020_21_KC_TB"), - game_type = c("CON", "CON", "SB"), - away_team = c("TB", "BUF", "KC"), - away_score = c(31L, 24L, 9L), - home_team = c("GB", "KC", "TB"), - home_score = c(26L, 38L, 31L), - location = c("Home", "Home", "Neutral"), - result = c(-5L, 14L, 22L), + game_id = c("2020_20_TB_GB", "2020_20_BUF_KC", "2020_21_KC_TB"), + game_type = c("CON", "CON", "SB"), + away_team = c("TB", "BUF", "KC"), + away_score = c(31L, 24L, 9L), + home_team = c("GB", "KC", "TB"), + home_score = c(26L, 38L, 31L), + location = c("Home", "Home", "Neutral"), + result = c(-5L, 14L, 22L), spread_line = c(3, 3, -3) ) clean_homeaway(s, invert = c("result","spread_line")) } -} diff --git a/man/clean_player_names.Rd b/man/clean_player_names.Rd index b5f7bf21..6ef29e62 100644 --- a/man/clean_player_names.Rd +++ b/man/clean_player_names.Rd @@ -36,7 +36,7 @@ Applies some name-cleaning heuristics to facilitate joins. These heuristics may Equivalent to the operation done by \code{ffscrapr::dp_clean_names()} and uses the same player name database. } \examples{ - +\dontshow{.for_cran()} clean_player_names(c("A.J. Green", "Odell Beckham Jr. ", "Le'Veon Bell Sr.")) clean_player_names(c("Trubisky, Mitch", "Atwell, Chatarius", "Elliott, Zeke", "Elijah Moore"), diff --git a/man/clean_team_abbrs.Rd b/man/clean_team_abbrs.Rd index 41a33c1c..6372dbf1 100644 --- a/man/clean_team_abbrs.Rd +++ b/man/clean_team_abbrs.Rd @@ -27,6 +27,7 @@ This function standardizes NFL team abbreviations to nflverse defaults. This helps for joins and plotting, especially with the new nflplotR package! } \examples{ +\dontshow{.for_cran()} x <- c("PIE", "LAR", "PIT", "CRD", "OAK", "SL") # use current location and keep non matches clean_team_abbrs(x) diff --git a/man/csv_from_url.Rd b/man/csv_from_url.Rd index 74ca6dfd..03ffcfd5 100644 --- a/man/csv_from_url.Rd +++ b/man/csv_from_url.Rd @@ -56,6 +56,7 @@ a dataframe as created by \code{\link[data.table:fread]{data.table::fread()}} This is a thin wrapper on data.table::fread, but memoised & cached for twenty four hours. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors csv_from_url("https://github.com/nflverse/nflverse-data/releases/download/test/combines.csv") diff --git a/man/dot-for_cran.Rd b/man/dot-for_cran.Rd index 07748044..6dee000f 100644 --- a/man/dot-for_cran.Rd +++ b/man/dot-for_cran.Rd @@ -10,3 +10,4 @@ Some code to comply with CRAN policies, e.g. limiting data.table CPU cores for examples/tests } +\keyword{internal} diff --git a/man/join_coalesce.Rd b/man/join_coalesce.Rd index 9082cf11..1847e36e 100644 --- a/man/join_coalesce.Rd +++ b/man/join_coalesce.Rd @@ -42,7 +42,7 @@ columns that have shared names (i.e. fills in NAs). A utility function primarily used internally within nflverse to help build player IDs } \examples{ - +\dontshow{.for_cran()} x <- data.frame(id1 = c(NA_character_,letters[1:4]), a = c(1,NA,3,NA,5), b = 1:5 * 10) y <- data.frame(id2 = c(letters[3:11],NA_character_), a = -(1:10), c = 1:10 * 100) diff --git a/man/load_combine.Rd b/man/load_combine.Rd index f3709555..98e8c4b9 100644 --- a/man/load_combine.Rd +++ b/man/load_combine.Rd @@ -22,6 +22,7 @@ A tibble of NFL combine data provided by Pro Football Reference. Loads combine data since 2000 courtesy of PFR. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_combine() diff --git a/man/load_contracts.Rd b/man/load_contracts.Rd index 64d965b4..b3a35cb7 100644 --- a/man/load_contracts.Rd +++ b/man/load_contracts.Rd @@ -17,6 +17,7 @@ A tibble of active and non-active NFL player contracts. Loads player contracts from OverTheCap.com } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_contracts() diff --git a/man/load_depth_charts.Rd b/man/load_depth_charts.Rd index d3f766dd..9a59c2ad 100644 --- a/man/load_depth_charts.Rd +++ b/man/load_depth_charts.Rd @@ -22,6 +22,7 @@ A tibble of week-level depth charts for each team. Loads depth charts for each NFL team for each week back to 2001. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_depth_charts(2020) diff --git a/man/load_draft_picks.Rd b/man/load_draft_picks.Rd index 08462e1e..9232221e 100644 --- a/man/load_draft_picks.Rd +++ b/man/load_draft_picks.Rd @@ -22,6 +22,7 @@ A tibble of NFL draft picks provided by Pro Football Reference. Loads every draft pick since 1980 courtesy of PFR. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_draft_picks() diff --git a/man/load_espn_qbr.Rd b/man/load_espn_qbr.Rd index 20a147db..40711304 100644 --- a/man/load_espn_qbr.Rd +++ b/man/load_espn_qbr.Rd @@ -24,6 +24,7 @@ a tibble of season-level injury report data. Load ESPN's QBR } \examples{ +\dontshow{.for_cran()} \donttest{ load_espn_qbr("nfl",2020) } diff --git a/man/load_ff_playerids.Rd b/man/load_ff_playerids.Rd index f93f8c71..17759da0 100644 --- a/man/load_ff_playerids.Rd +++ b/man/load_ff_playerids.Rd @@ -13,6 +13,7 @@ a dataframe of player IDs Accesses DynastyProcess.com's database of fantasy football player IDs, which help connect nflverse to various other platforms and IDs. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_ff_playerids() diff --git a/man/load_from_url.Rd b/man/load_from_url.Rd index 7ab03dc8..f71b498a 100644 --- a/man/load_from_url.Rd +++ b/man/load_from_url.Rd @@ -22,6 +22,7 @@ a dataframe, possibly of type \code{nflverse_data} Load any rds/csv/csv.gz/parquet/qs file from a remote URL } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors urls <- c("https://github.com/nflverse/nflverse-data/releases/download/rosters/roster_2020.csv", diff --git a/man/load_injuries.Rd b/man/load_injuries.Rd index 6c5c5a8c..07f45561 100644 --- a/man/load_injuries.Rd +++ b/man/load_injuries.Rd @@ -22,6 +22,7 @@ a tibble of season-level injury report data. Data collected from an API for weekly injury report data. } \examples{ +\dontshow{.for_cran()} \donttest{ try({# prevents cran errors load_injuries(2020) diff --git a/man/load_nextgen_stats.Rd b/man/load_nextgen_stats.Rd index 12d432b7..5f58d2de 100644 --- a/man/load_nextgen_stats.Rd +++ b/man/load_nextgen_stats.Rd @@ -29,6 +29,7 @@ the current season's data updates every night. NGS will only provide data for players above a minimum number of pass/rush/rec attempts. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_nextgen_stats(stat_type = "passing") diff --git a/man/load_officials.Rd b/man/load_officials.Rd index 7de25a59..369c8278 100644 --- a/man/load_officials.Rd +++ b/man/load_officials.Rd @@ -22,6 +22,7 @@ A tibble with one row per game per official. Loads data on which officials are assigned to oversee a specific game. Data available from 2015 onwards. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_officials() diff --git a/man/load_participation.Rd b/man/load_participation.Rd index 66fc44e2..d2fce572 100644 --- a/man/load_participation.Rd +++ b/man/load_participation.Rd @@ -25,6 +25,7 @@ A dataframe of participation data, optionally merged with play by play Loads participation data from the \href{https://github.com/nflverse/nflverse-data}{nflverse-data repository} } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_participation(seasons = 2020, include_pbp = TRUE) diff --git a/man/load_pbp.Rd b/man/load_pbp.Rd index d09596b8..ad506633 100644 --- a/man/load_pbp.Rd +++ b/man/load_pbp.Rd @@ -23,6 +23,7 @@ The complete nflfastR dataset as returned by \code{nflfastR::build_nflfastR_pbp( Loads play by play seasons from the \href{https://github.com/nflverse/nflverse-data}{nflverse-data repository} } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_pbp(2019:2020) diff --git a/man/load_pfr_advstats.Rd b/man/load_pfr_advstats.Rd index fed607f4..bbc28475 100644 --- a/man/load_pfr_advstats.Rd +++ b/man/load_pfr_advstats.Rd @@ -29,6 +29,7 @@ Loads player level season stats provided by Pro Football Reference starting with the 2018 season, primarily to augment existing nflverse data. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_pfr_advstats() diff --git a/man/load_pfr_passing.Rd b/man/load_pfr_passing.Rd index 068967f1..ddcea098 100644 --- a/man/load_pfr_passing.Rd +++ b/man/load_pfr_passing.Rd @@ -17,6 +17,7 @@ Loads player level season stats provided by Pro Football Reference starting with the 2019 season. } \examples{ +\dontshow{.for_cran()} \donttest{ load_pfr_passing() } diff --git a/man/load_player_stats.Rd b/man/load_player_stats.Rd index 141d4b7b..6afbf89a 100644 --- a/man/load_player_stats.Rd +++ b/man/load_player_stats.Rd @@ -25,6 +25,7 @@ A tibble of week-level player statistics that aims to match NFL official box sco Load Player Level Weekly Stats } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_player_stats() diff --git a/man/load_players.Rd b/man/load_players.Rd index a4ff3b1b..5007d328 100644 --- a/man/load_players.Rd +++ b/man/load_players.Rd @@ -17,6 +17,7 @@ A tibble with one row per player. Load a dataframe of player-level information, including IDs and other mostly-immutable data (birthdates, college, draft position etc.) } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_players() diff --git a/man/load_rosters.Rd b/man/load_rosters.Rd index d9970e94..a4c08b4d 100644 --- a/man/load_rosters.Rd +++ b/man/load_rosters.Rd @@ -24,6 +24,7 @@ A tibble of season-level roster data. Load Rosters } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_rosters(2020) diff --git a/man/load_rosters_weekly.Rd b/man/load_rosters_weekly.Rd index 3b2c865a..4546f554 100644 --- a/man/load_rosters_weekly.Rd +++ b/man/load_rosters_weekly.Rd @@ -24,6 +24,7 @@ A tibble of weekly roster data. Returns week level rosters (rather than latest for a given season as returned by \code{load_rosters()}) } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_rosters_weekly(2020) diff --git a/man/load_schedules.Rd b/man/load_schedules.Rd index 436389f9..52ce87fd 100644 --- a/man/load_schedules.Rd +++ b/man/load_schedules.Rd @@ -16,6 +16,7 @@ A tibble of game information for past and/or future games. This returns game/schedule information as maintained by Lee Sharpe. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_schedules(2020) diff --git a/man/load_snap_counts.Rd b/man/load_snap_counts.Rd index 658c8af4..4d0b9a08 100644 --- a/man/load_snap_counts.Rd +++ b/man/load_snap_counts.Rd @@ -23,6 +23,7 @@ Loads game level snap counts stats provided by Pro Football Reference starting with the 2012 season. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents CRAN errors load_snap_counts() diff --git a/man/load_teams.Rd b/man/load_teams.Rd index 96af1244..6dc26dc9 100644 --- a/man/load_teams.Rd +++ b/man/load_teams.Rd @@ -17,6 +17,7 @@ A tibble of team-level image URLs and hex color codes. Loads team graphics, colors, and logos - useful for plots! } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors load_teams() diff --git a/man/load_trades.Rd b/man/load_trades.Rd index bd5c83ad..5949ab78 100644 --- a/man/load_trades.Rd +++ b/man/load_trades.Rd @@ -16,6 +16,7 @@ A tibble of game information for past and/or future games. This returns a table of historical trades as maintained by Lee Sharpe. } \examples{ +\dontshow{.for_cran()} \donttest{ load_trades(2020) } diff --git a/man/nflverse_download.Rd b/man/nflverse_download.Rd index 87274273..dd20754d 100644 --- a/man/nflverse_download.Rd +++ b/man/nflverse_download.Rd @@ -32,7 +32,7 @@ This function downloads or updates data from the nflverse-data repository releas creating subfolders that match the release structure. } \examples{ -{ +\dontshow{.for_cran()} \donttest{ try({ ## could also set options like @@ -44,4 +44,3 @@ try({ }) } } -} diff --git a/man/nflverse_game_id.Rd b/man/nflverse_game_id.Rd index 6d76e374..52df6674 100644 --- a/man/nflverse_game_id.Rd +++ b/man/nflverse_game_id.Rd @@ -20,5 +20,6 @@ A character vector Compute nflverse Game Identifiers } \examples{ +\dontshow{.for_cran()} nflverse_game_id(2022, 2, "LAC", "KC") } diff --git a/man/nflverse_releases.Rd b/man/nflverse_releases.Rd index 6bd6f16a..ffcbf5d9 100644 --- a/man/nflverse_releases.Rd +++ b/man/nflverse_releases.Rd @@ -19,15 +19,20 @@ in the nflverse-data repo. Release names can be used for downloads in \code{\link[=nflverse_download]{nflverse_download()}}. } \examples{ -\donttest{ +\dontshow{ +.for_cran() # Change option for better output old <- options(piggyback.verbose = FALSE) +} +\donttest{ try( # avoids cran failures, can skip in normal usage nflverse_releases() ) - +} +\dontshow{ # Restore old options options(old) } + } diff --git a/man/parquet_from_url.Rd b/man/parquet_from_url.Rd index 55497b48..dc8722ef 100644 --- a/man/parquet_from_url.Rd +++ b/man/parquet_from_url.Rd @@ -16,6 +16,7 @@ a dataframe as parsed by \code{\link[arrow:read_parquet]{arrow::read_parquet()}} Retrieves a parquet file from URL. This function is cached } \examples{ +\dontshow{.for_cran()} \donttest{ try({ parquet_from_url( diff --git a/man/progressively.Rd b/man/progressively.Rd index a47b240d..eaaa501b 100644 --- a/man/progressively.Rd +++ b/man/progressively.Rd @@ -20,7 +20,7 @@ it will return a new function that calls \code{f()} and then (on exiting) will c This is inspired by purrr's \code{safely}, \code{quietly}, and \code{possibly} function decorators. } \examples{ - +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors diff --git a/man/qs_from_url.Rd b/man/qs_from_url.Rd index 2909bb6c..c624911e 100644 --- a/man/qs_from_url.Rd +++ b/man/qs_from_url.Rd @@ -16,6 +16,7 @@ a dataframe as parsed by \code{\link[qs:qdeserialize]{qs::qdeserialize()}} Load .qs file from a remote connection } \examples{ +\dontshow{.for_cran()} \donttest{ try({ qs_from_url( diff --git a/man/raw_from_url.Rd b/man/raw_from_url.Rd index 120c257a..895b2032 100644 --- a/man/raw_from_url.Rd +++ b/man/raw_from_url.Rd @@ -17,6 +17,7 @@ This function allows you to retrieve data from a URL into raw format, which can then be passed into the appropriate file-reading function. Data is memoised/cached for 24 hours. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents CRAN errors head(raw_from_url( diff --git a/man/rds_from_url.Rd b/man/rds_from_url.Rd index 85d60826..c97d35b5 100644 --- a/man/rds_from_url.Rd +++ b/man/rds_from_url.Rd @@ -16,6 +16,7 @@ a dataframe as created by \code{\link[=readRDS]{readRDS()}} Load .rds file from a remote connection } \examples{ +\dontshow{.for_cran()} \donttest{ try({ # prevents cran errors rds_from_url("https://github.com/nflverse/nflverse-data/releases/download/test/combines.rds") diff --git a/man/sitrep.Rd b/man/sitrep.Rd index 34b0fb0a..71be1d2e 100644 --- a/man/sitrep.Rd +++ b/man/sitrep.Rd @@ -46,6 +46,7 @@ It's primarily designed to help you get a quick idea of what's going on when you're helping someone else debug a problem. } \examples{ +\dontshow{.for_cran()} \donttest{ try({ nflverse_sitrep() diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R new file mode 100644 index 00000000..e69de29b