Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up internal namespace and directly re-export nflreadr functions #508

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Imports:
glue,
janitor,
lifecycle,
magrittr,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to get rid of the magrittr pipe and never imported it because the pipe is reexported in dplyr and we need to watch the number of dependencies

mgcv,
nflreadr (>= 1.2.0),
progressr (>= 0.6.0),
Expand Down
38 changes: 8 additions & 30 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,50 +19,28 @@ export(fast_scraper_roster)
export(fast_scraper_schedules)
export(load_pbp)
export(load_player_stats)
export(load_rosters)
export(load_schedules)
export(missing_raw_pbp)
export(nflverse_sitrep)
export(report)
export(save_raw_pbp)
export(update_db)
import(dplyr)
import(fastrmodels)
importFrom(cli,rule)
importFrom(curl,curl_fetch_memory)
importFrom(data.table,"%between%")
importFrom(data.table,"%chin%")
importFrom(data.table,setDT)
importFrom(furrr,future_map)
importFrom(furrr,future_map_chr)
importFrom(furrr,future_map_dfr)
importFrom(future,plan)
importFrom(glue,glue)
importFrom(glue,glue_sql)
importFrom(janitor,clean_names)
importFrom(lifecycle,deprecated)
importFrom(mgcv,predict.bam)
importFrom(magrittr,"%>%")
importFrom(nflreadr,load_pbp)
importFrom(nflreadr,load_player_stats)
importFrom(nflreadr,load_rosters)
importFrom(nflreadr,load_schedules)
importFrom(nflreadr,nflverse_sitrep)
importFrom(progressr,progressor)
importFrom(rlang,"%||%")
importFrom(rlang,":=")
importFrom(rlang,.data)
importFrom(rlang,.env)
importFrom(rlang,dots_list)
importFrom(rlang,inform)
importFrom(stats,na.omit)
importFrom(stats,predict)
importFrom(stringr,str_detect)
importFrom(stringr,str_extract)
importFrom(stringr,str_extract_all)
importFrom(stringr,str_length)
importFrom(stringr,str_remove_all)
importFrom(stringr,str_replace_all)
importFrom(stringr,str_split)
importFrom(stringr,str_sub)
importFrom(stringr,str_trim)
importFrom(tibble,as_tibble)
importFrom(tibble,tibble)
importFrom(tidyr,unnest)
importFrom(tidyr,unnest_wider)
importFrom(tidyselect,any_of)
importFrom(tidyselect,ends_with)
importFrom(utils,packageVersion)
importFrom(xgboost,getinfo)
12 changes: 0 additions & 12 deletions R/load_pbp.R

This file was deleted.

30 changes: 0 additions & 30 deletions R/load_player_stats.R

This file was deleted.

47 changes: 31 additions & 16 deletions R/nflfastR-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -103,25 +103,40 @@
# The following block is used by usethis to automatically manage
# roxygen namespace tags. Modify with care!
## usethis namespace: start
#' @import dplyr
#' @import fastrmodels
#' @importFrom cli rule
#' @importFrom curl curl_fetch_memory
#' @importFrom nflreadr load_pbp load_player_stats load_schedules load_rosters nflverse_sitrep
#' @importFrom magrittr %>%
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import from dplyr

#' @importFrom data.table setDT %between% %chin%
#' @importFrom furrr future_map_chr future_map_dfr future_map
#' @importFrom future plan
#' @importFrom glue glue glue_sql
#' @importFrom janitor clean_names
#' @importFrom lifecycle deprecated
#' @importFrom mgcv predict.bam
#' @importFrom progressr progressor
#' @importFrom rlang .data inform dots_list := .env
#' @importFrom rlang .data inform dots_list := .env %||%
#' @importFrom stats predict na.omit
#' @importFrom stringr str_sub str_replace_all str_length str_extract str_detect str_trim str_remove_all str_split str_extract_all
#' @importFrom tibble as_tibble tibble
#' @importFrom tidyr unnest_wider unnest
#' @importFrom tidyselect any_of ends_with
#' @importFrom utils packageVersion
#' @importFrom xgboost getinfo
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nflfastR needs xgboost to apply the models but there is no actual function call to xgboost which results in a R CMD Check note. That's why I import a dummy.

## usethis namespace: end
NULL

#' @export
nflreadr::load_pbp
#' @export
nflreadr::load_player_stats
#' @export
nflreadr::load_schedules
#' @export
nflreadr::load_rosters
#' @export
nflreadr::nflverse_sitrep

## NO LONGER IMPORTED, WILL USE EXPLICIT NAMESPACING INSTEAD
# @import dplyr
# @importFrom cli rule
# @importFrom curl curl_fetch_memory
# @importFrom furrr future_map_chr future_map_dfr future_map
# @importFrom future plan
# @importFrom glue glue glue_sql
# @importFrom janitor clean_names
# @importFrom lifecycle deprecated
# @importFrom mgcv predict.bam
# @importFrom progressr progressor
# @importFrom stringr str_sub str_replace_all str_length str_extract str_detect str_trim str_remove_all str_split str_extract_all
# @importFrom tibble as_tibble tibble
# @importFrom tidyr unnest_wider unnest
# @importFrom tidyselect any_of ends_with
# @importFrom xgboost getinfo
32 changes: 0 additions & 32 deletions R/report.R
Original file line number Diff line number Diff line change
@@ -1,32 +0,0 @@
#' Get a Situation Report on System, nflverse Package Versions and Dependencies
#'
#' @description This function gives a quick overview of the versions of R and
#' the operating system as well as the versions of nflverse packages, options,
#' and their dependencies. 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.
#' @details See [`nflreadr::nflverse_sitrep`] for details.
#' @inheritDotParams nflreadr::nflverse_sitrep
#' @inherit nflreadr::nflverse_sitrep
#' @examples
#' \donttest{
#' \dontshow{
#' # set CRAN mirror to avoid failing checks in weird scenarios
#' old_ops <- options(repos = c("CRAN" = "https://cran.rstudio.com/"))
#' }
#'
#' report(recursive = FALSE)
#' nflverse_sitrep(pkg = "nflreadr", recursive = TRUE)
#'
#' \dontshow{
#' # restore old options
#' options(old_ops)
#' }
#' }
#' @export
report <- function(...) nflreadr::nflverse_sitrep(...)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not happy with silently dropping the function report completely


#' @export
#' @name nflverse_sitrep
#' @rdname report
#' @importFrom nflreadr nflverse_sitrep
NULL
2 changes: 0 additions & 2 deletions R/top-level_scraper.R
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ fast_scraper <- function(game_ids,

#' Load Team Rosters for Multiple Seasons
#' @details See [`nflreadr::load_rosters`] for details.
#' @inheritDotParams nflreadr::load_rosters
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This produces in a check warning

#' @inherit nflreadr::load_rosters
#' @seealso For information on parallel processing and progress updates please
#' see [nflfastR].
Expand All @@ -484,7 +483,6 @@ fast_scraper_roster <- function(...) nflreadr::load_rosters(...)

#' Load NFL Season Schedules
#' @details See [`nflreadr::load_schedules`] for details.
#' @inheritDotParams nflreadr::load_schedules
#' @inherit nflreadr::load_schedules
#' @seealso For information on parallel processing and progress updates please
#' see [nflfastR].
Expand Down
11 changes: 0 additions & 11 deletions man/fast_scraper_roster.Rd

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

7 changes: 0 additions & 7 deletions man/fast_scraper_schedules.Rd

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

41 changes: 0 additions & 41 deletions man/load_pbp.Rd

This file was deleted.

36 changes: 0 additions & 36 deletions man/load_player_stats.Rd

This file was deleted.

20 changes: 20 additions & 0 deletions man/reexports.Rd

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

Loading
Loading