diff --git a/.github/workflows/R-CMD-check.yaml b/.github/workflows/R-CMD-check.yaml index 35ef5fa..5e69b7e 100644 --- a/.github/workflows/R-CMD-check.yaml +++ b/.github/workflows/R-CMD-check.yaml @@ -29,6 +29,8 @@ jobs: env: GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} R_KEEP_PKG_SOURCE: yes + _R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_: "2.5" + _R_CHECK_TEST_TIMING_CPU_TO_ELAPSED_THRESHOLD_: "NA" steps: - uses: actions/checkout@v3 diff --git a/CRAN-SUBMISSION b/CRAN-SUBMISSION new file mode 100644 index 0000000..68ca011 --- /dev/null +++ b/CRAN-SUBMISSION @@ -0,0 +1,3 @@ +Version: 1.3.1 +Date: 2024-03-25 12:31:30 UTC +SHA: 7dd173bbc44f36fe18c7f76a877684469a5a98b0 diff --git a/DESCRIPTION b/DESCRIPTION index 8c111f2..4ee1a8e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: nflplotR Title: NFL Logo Plots in 'ggplot2' and 'gt' -Version: 1.3.0 +Version: 1.3.1 Authors@R: person("Sebastian", "Carl", , "mrcaseb@gmail.com", role = c("aut", "cre")) Description: A set of functions to visualize National Football League diff --git a/NEWS.md b/NEWS.md index 7cba65d..4bede62 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# nflplotR 1.3.1 + +* Adjusted internals by CRAN request. No visible changes for the user. (#60) + # nflplotR 1.3.0 ## New Features diff --git a/R/theme-elements.R b/R/theme-elements.R index dec815a..e4aca8b 100644 --- a/R/theme-elements.R +++ b/R/theme-elements.R @@ -9,9 +9,6 @@ #' - `element_nfl_headshot()`: draws NFL player headshots instead of their GSIS IDs. #' - `element_path()`: draws images from valid image URLs instead of the URL. #' -#' @inheritParams ggpath::element_path -#' @inheritDotParams ggpath::element_path -#' #' @details The elements translate NFL team abbreviations or NFL player GSIS IDs #' into logo images or player headshots, respectively. #' @param alpha The alpha channel, i.e. transparency level, as a numerical value @@ -23,6 +20,7 @@ #' @param hjust,vjust The horizontal and vertical adjustment respectively. #' Must be a numerical value between 0 and 1. #' @param size The output grob size in `cm` (!). +#' @param ... Arguments passed on to [ggpath::element_path] #' @seealso [geom_nfl_logos()], [geom_nfl_headshots()], [geom_nfl_wordmarks()], #' and [geom_from_path()] for more information on valid team abbreviations, #' player IDs, and other parameters. diff --git a/R/zzz.R b/R/zzz.R index 0725cb8..873efb0 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -27,24 +27,24 @@ # (EDIT: They probably use different ones in R DEVEL) # which means "more than two cores are running". # We check for these environment variables and if we find them - # we set data.table to two threads and the OMP library + # we set data.table to two threads # nflplotR depends on magick which also uses OMP but doesn't respect # OMP_THREAD_LIMIT. I have to skip the related tests unfortunately. - cpu_check <- as.numeric( - c( + cpu_check <- suppressWarnings(stats::na.omit(as.numeric(c( Sys.getenv("_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_", unset = 0), Sys.getenv("_R_CHECK_TEST_TIMING_CPU_TO_ELAPSED_THRESHOLD_", unset = 0) - ) - ) + )))) if (any(cpu_check != 0)) { - cores <- min( + cores <- suppressWarnings(min( floor(as.integer(Sys.getenv("_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_"))), floor(as.integer(Sys.getenv("_R_CHECK_TEST_TIMING_CPU_TO_ELAPSED_THRESHOLD_"))), 2L, na.rm = TRUE - ) + )) Sys.setenv("OMP_THREAD_LIMIT" = cores) + # see https://stat.ethz.ch/pipermail/r-package-devel/2023q4/009969.html + Sys.setenv("OMP_NUM_THREADS" = cores) data.table::setDTthreads(cores) } } diff --git a/cran-comments.md b/cran-comments.md index 15e986a..3fcae89 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,6 +1,6 @@ ## Submission -This is a minor release that updates internal files and improves some functions. +This is a minor release that updates internal functionality requested by CRAN. ## R CMD check results diff --git a/man/element.Rd b/man/element.Rd index 3226c45..17ca3bf 100644 --- a/man/element.Rd +++ b/man/element.Rd @@ -50,17 +50,7 @@ Must be a numerical value between 0 and 1.} \item{size}{The output grob size in \code{cm} (!).} -\item{...}{ - Arguments passed on to \code{\link[ggpath:element_path]{ggpath::element_path}} - \describe{ - \item{\code{colour,color}}{The image will be colorized with this color. Use the -special character \code{"b/w"} to set it to black and white. For more information -on valid color names in ggplot2 see -\url{https://ggplot2.tidyverse.org/articles/ggplot2-specs.html?q=colour#colour-and-fill}.} - \item{\code{hjust,vjust}}{The horizontal and vertical adjustment respectively. -Must be a numerical value between 0 and 1.} - \item{\code{angle}}{The angle of the element as a numerical value between 0° and 360°.} - }} +\item{...}{Arguments passed on to \link[ggpath:element_path]{ggpath::element_path}} } \value{ An S3 object of class \code{element}. diff --git a/tests/testthat/_snaps/geom_nfl_logos/p1.svg b/tests/testthat/_snaps/geom_nfl_logos/p1.svg index a4116c7..c7683fb 100644 --- a/tests/testthat/_snaps/geom_nfl_logos/p1.svg +++ b/tests/testthat/_snaps/geom_nfl_logos/p1.svg @@ -36,27 +36,27 @@ - + DEN - + KC - + LA - + CAR - + LAC - + IND - + DAL - + ARI - + WAS - + MIN - + TB diff --git a/tests/testthat/_snaps/geom_nfl_logos/p2.svg b/tests/testthat/_snaps/geom_nfl_logos/p2.svg index 75a765a..fd38c88 100644 --- a/tests/testthat/_snaps/geom_nfl_logos/p2.svg +++ b/tests/testthat/_snaps/geom_nfl_logos/p2.svg @@ -37,29 +37,29 @@ - + CHI - + JAX - + PIT - + CIN - + DET - + NYJ - + CLE - + NE - + AFC - + SEA - + GB - + PHI diff --git a/tests/testthat/_snaps/geom_nfl_logos/p3.svg b/tests/testthat/_snaps/geom_nfl_logos/p3.svg index 24e014e..b3d4750 100644 --- a/tests/testthat/_snaps/geom_nfl_logos/p3.svg +++ b/tests/testthat/_snaps/geom_nfl_logos/p3.svg @@ -36,27 +36,27 @@ - + ATL - + BAL - + BUF - + HOU - + LV - + MIA - + NFC - + NO - + NYG - + SF - + TEN diff --git a/tests/testthat/_snaps/geom_nfl_wordmarks/p1.svg b/tests/testthat/_snaps/geom_nfl_wordmarks/p1.svg index 0a4535f..0f014ab 100644 --- a/tests/testthat/_snaps/geom_nfl_wordmarks/p1.svg +++ b/tests/testthat/_snaps/geom_nfl_wordmarks/p1.svg @@ -41,37 +41,37 @@ - + KC - + MIA - + TB - + ARI - + LAC - + IND - + TEN - + PIT - + NO - + CLE - + CIN - + MIN - + DAL - + JAX - + ATL - + BAL diff --git a/tests/testthat/_snaps/geom_nfl_wordmarks/p2.svg b/tests/testthat/_snaps/geom_nfl_wordmarks/p2.svg index bf780db..905eeb3 100644 --- a/tests/testthat/_snaps/geom_nfl_wordmarks/p2.svg +++ b/tests/testthat/_snaps/geom_nfl_wordmarks/p2.svg @@ -41,37 +41,37 @@ - + BUF - + CAR - + CHI - + DEN - + DET - + GB - + HOU - + LA - + LV - + NE - + NYG - + NYJ - + PHI - + SEA - + SF - + WAS diff --git a/tests/testthat/setup.R b/tests/testthat/setup.R deleted file mode 100644 index 337ba90..0000000 --- a/tests/testthat/setup.R +++ /dev/null @@ -1,28 +0,0 @@ -# CRAN incoming checks can fail if tests use more than 2 cores. -# We can run in this problem by using data.table https://github.com/Rdatatable/data.table/issues/5658 -# R CMD Check throws the NOTE because CRAN sets -# _R_CHECK_TEST_TIMING_CPU_TO_ELAPSED_THRESHOLD_ and/or -# _R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_to "2.5" -# (EDIT: They probably use different ones in R DEVEL) -# which means "more than two cores are running". -# We check for these environment variables and if we find them -# we set data.table to two threads and the OMP library -# nflplotR depends on magick which also uses OMP but doesn't respect -# OMP_THREAD_LIMIT. I have to skip the related tests unfortunately. -cpu_check <- as.numeric( - c( - Sys.getenv("_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_", unset = 0), - Sys.getenv("_R_CHECK_TEST_TIMING_CPU_TO_ELAPSED_THRESHOLD_", unset = 0) - ) -) - -if (any(cpu_check != 0)) { - cores <- min( - floor(as.integer(Sys.getenv("_R_CHECK_EXAMPLE_TIMING_CPU_TO_ELAPSED_THRESHOLD_"))), - floor(as.integer(Sys.getenv("_R_CHECK_TEST_TIMING_CPU_TO_ELAPSED_THRESHOLD_"))), - 2L, - na.rm = TRUE - ) - Sys.setenv("OMP_THREAD_LIMIT" = cores) - data.table::setDTthreads(cores) -} diff --git a/tests/testthat/test-nfl_team_tiers.R b/tests/testthat/test-nfl_team_tiers.R index f3ad3cc..f56e59c 100644 --- a/tests/testthat/test-nfl_team_tiers.R +++ b/tests/testthat/test-nfl_team_tiers.R @@ -1,4 +1,7 @@ test_that("team tiers work", { + # skip because of data.table multithreading + skip_on_cran() + library(ggplot2) teams <- nflplotR::valid_team_names() # remove conference logos from this example diff --git a/vignettes/articles/nflplotR.Rmd b/vignettes/articles/nflplotR.Rmd index 7c856a1..674dcce 100644 --- a/vignettes/articles/nflplotR.Rmd +++ b/vignettes/articles/nflplotR.Rmd @@ -344,6 +344,12 @@ ggplot(df, aes(x = mpg, y = disp)) + ) ``` +```{r, echo=FALSE, message=FALSE} +# the pkgdown workflow ran in cache size problems +# so we clear the cache here hoping to resolve the issue +nflplotR::.nflplotR_clear_cache() +``` + Or maybe facet by player and use headshots... ```{r}