ESPN issue
Describe the bug plot not outputting correctly.
Reprex
For more on reprexes, check out https://reprex.tidyverse.org
install.packages("ffsimulator", repos = "https://ffverse.r-universe.dev")
# pak is recommended, see https://github.com/r-lib/pak
pak::pak("ffverse/ffsimulator")
# can also use remotes
remotes::install_github("ffverse/ffsimulator")
library(ffsimulator)
library(ggplot2)
library(ggridges)
espn_conn <- espn_connect(season = 2023, league_id = 352072624)
mfl_sim <- ff_simulate(conn = espn_conn, n_seasons = 100)
plot(mfl_sim)
> library(ffsimulator)
There were 18 warnings (use warnings() to see them)
> library(ggplot2)
> library(ggridges)
> espn_conn <- espn_connect(season = 2023, league_id = 352072624)
> mfl_sim <- ff_simulate(conn = espn_conn, n_seasons = 100)
── Starting simulation 2024-02-19 13:46:41.149558 ───────────────────────────────────────────────────────────────────────────────────
✔ Importing data ... done
Note: nflreadr caches (i.e., stores a saved version) data by default.
If you expect different output try one of the following:
ℹ Restart your R Session or
ℹ Run `nflreadr::.clear_cache()`.
To disable this warning, run `options(nflreadr.verbose = FALSE)` or add it to your .Rprofile
This message is displayed once every 8 hours.
✔ Generating Projections ... done
✔ Calculating Roster Scores ... done
✔ Optimizing Lineups ... done
✔ Building Schedules ... done
✔ Summarising Simulation Data ... done
── Simulation complete! 2024-02-19 13:47:02.733481 ──────────────────────────────────────────────────────────────────────────────────
> plot(mfl_sim)
Expected behavior Show correct plot w/ team names. League name importing correctly.
Session information
Please copy the output of sessionInfo() into the box below.
> sessionInfo()
R version 4.3.1 (2023-06-16)
Platform: aarch64-apple-darwin20 (64-bit)
Running under: macOS Sonoma 14.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/lib/libRlapack.dylib; LAPACK version 3.11.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] ggridges_0.5.5 ggplot2_3.4.4 ffsimulator_1.2.3.01
loaded via a namespace (and not attached):
[1] httr2_1.0.0 remotes_2.4.2.1 rematch2_2.1.2 rlang_1.1.3 magrittr_2.0.3 snakecase_0.11.1
[7] furrr_0.3.1 compiler_4.3.1 vctrs_0.6.5 ffscrapr_1.4.8 rvest_1.0.3 stringr_1.5.1
[13] profvis_0.3.8 pkgconfig_2.0.3 fastmap_1.1.1 backports_1.4.1 ellipsis_0.3.2 utf8_1.2.4
[19] promises_1.2.1 rmarkdown_2.25 sessioninfo_1.2.2 tzdb_0.4.0 purrr_1.0.2 bit_4.0.5
[25] xfun_0.41 cachem_1.0.8 jsonlite_1.8.8 pak_0.7.1 later_1.3.2 parallel_4.3.1
[31] R6_2.5.1 stringi_1.8.3 parallelly_1.36.0 pkgload_1.3.4 lubridate_1.9.3 Rcpp_1.0.12
[37] assertthat_0.2.1 knitr_1.45 usethis_2.2.2 cbbdata_0.3.0 readr_2.1.5 httpuv_1.6.14
[43] timechange_0.3.0 tidyselect_1.2.0 nbastatR_0.1.152 rstudioapi_0.15.0 yaml_2.3.8 codetools_0.2-19
[49] miniUI_0.1.1.1 curl_5.2.0 listenv_0.9.1 pkgbuild_1.4.3 tibble_3.2.1 shiny_1.8.0
[55] withr_3.0.0 nflreadr_1.4.0 evaluate_0.23 ratelimitr_0.4.1 future_1.33.1 RcppParallel_5.1.7
[61] urlchecker_1.0.1 xml2_1.3.6 pillar_1.9.0 checkmate_2.3.1 generics_0.1.3 paletteer_1.5.0
[67] hms_1.1.3 munsell_0.5.0 scales_1.3.0 globals_0.16.2 xtable_1.8-4 slam_0.1-50
[73] glue_1.7.0 janitor_2.2.0 mlbplotR_1.1.0.9002 tools_4.3.1 data.table_1.15.0 fs_1.6.3
[79] grid_4.3.1 tidyr_1.3.1 devtools_2.4.5 colorspace_2.1-0 baseballr_1.6.0 cli_3.6.2
[85] rappdirs_0.3.3 fasttime_1.1-0 fansi_1.0.6 ggthemes_5.0.0 gt_0.10.1 arrow_14.0.0.2
[91] dplyr_1.1.4 gtable_0.3.4 digest_0.6.34 progressr_0.14.0 farver_2.1.1 htmlwidgets_1.6.4
[97] Rglpk_0.6-5.1 memoise_2.0.1 htmltools_0.5.7 lifecycle_1.0.4 httr_1.4.7 mime_0.12
[103] bit64_4.0.5
Screenshots
Additional context Add any other context about the problem here.
Restart R, install the development version of ffscrapr and try again: https://ffscrapr.ffverse.com/#installation
Same issue.
> install.packages("ffsimulator", repos = "https://ffverse.r-universe.dev")
trying URL 'https://ffverse.r-universe.dev/bin/macosx/big-sur-arm64/contrib/4.3/ffsimulator_1.2.3.01.tgz'
Content type 'application/x-gzip' length 4065674 bytes (3.9 MB)
==================================================
downloaded 3.9 MB
The downloaded binary packages are in
/var/folders/m0/0lm826c563q6bvzjkyh472wh0000gn/T//RtmpOaK5yp/downloaded_packages
> install.packages("ffsimulator", repos = "https://ffverse.r-universe.dev")
trying URL 'https://ffverse.r-universe.dev/bin/macosx/big-sur-arm64/contrib/4.3/ffsimulator_1.2.3.01.tgz'
Content type 'application/x-gzip' length 4065674 bytes (3.9 MB)
==================================================
downloaded 3.9 MB
The downloaded binary packages are in
/var/folders/m0/0lm826c563q6bvzjkyh472wh0000gn/T//RtmpOaK5yp/downloaded_packages
There were 18 warnings (use warnings() to see them)
> pak::pak("ffverse/ffsimulator")
! Using bundled GitHub PAT. Please add your own PAT using `gitcreds::gitcreds_set()`.
✔ Loading metadata database ... done
ℹ No downloads are needed
✔ 1 pkg + 40 deps: kept 41 [4.9s]
> remotes::install_github("ffverse/ffsimulator")
Downloading GitHub repo ffverse/ffsimulator@HEAD
── R CMD build ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
✔ checking for file ‘/private/var/folders/m0/0lm826c563q6bvzjkyh472wh0000gn/T/RtmpOaK5yp/remotesb5316435c7f8/ffverse-ffsimulator-838897a/DESCRIPTION’ ...
─ preparing ‘ffsimulator’:
✔ checking DESCRIPTION meta-information ...
─ checking for LF line-endings in source and make files and shell scripts
─ checking for empty or unneeded directories
─ building ‘ffsimulator_1.2.3.01.tar.gz’
* installing *source* package ‘ffsimulator’ ...
** using staged installation
** R
** data
*** moving datasets to lazyload DB
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
*** copying figures
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
** testing if installed package can be loaded from final location
** testing if installed package keeps a record of temporary installation path
* DONE (ffsimulator)
> library(ffsimulator)
> library(ggplot2)
> library(ggridges)
> espn_conn <- espn_connect(season = 2023, league_id = 352072624)
> mfl_sim <- ff_simulate(conn = espn_conn, n_seasons = 100)
── Starting simulation 2024-02-19 14:58:00.638701 ───────────────────────────────────────────────────────────────────────────────────
✔ Importing data ... done
Note: nflreadr caches (i.e., stores a saved version) data by default.
If you expect different output try one of the following:
ℹ Restart your R Session or
ℹ Run `nflreadr::.clear_cache()`.
To disable this warning, run `options(nflreadr.verbose = FALSE)` or add it to your .Rprofile
This message is displayed once every 8 hours.
✔ Generating Projections ... done
✔ Calculating Roster Scores ... done
✔ Optimizing Lineups ... done
✔ Building Schedules ... done
✔ Summarising Simulation Data ... done
── Simulation complete! 2024-02-19 14:58:24.3793 ────────────────────────────────────────────────────────────────────────────────────
> plot(mfl_sim)
mfl_sim <- ff_simulate(conn5, n_seasons = 500) ── Starting simulation 2024-05-19 20:51:16.416035 ────────────────────────────────────────────────────────────── ✔ Importing data ... done ✔ Generating Projections ... done Error: 'unnest.' is not an exported object from 'namespace:tidytable'
Same issue.
> install.packages("ffsimulator", repos = "https://ffverse.r-universe.dev") > pak::pak("ffverse/ffsimulator") > remotes::install_github("ffverse/ffsimulator")
Looks like you installed the development version of ffsimulator, where you needed the development of ffscrapr as well
mfl_sim <- ff_simulate(conn5, n_seasons = 500) ── Starting simulation 2024-05-19 20:51:16.416035 ────────────────────────────────────────────────────────────── ✔ Importing data ... done ✔ Generating Projections ... done Error: 'unnest.' is not an exported object from 'namespace:tidytable'
@sillebt Please install the development version of ffsimulator for this problem and/or open a new issue, this is unrelated to the issue from OP
having this issue now:
> library(ffsimulator)
Error: package or namespace load failed for ‘ffsimulator’:
.onLoad failed in loadNamespace() for 'nflreadr', details:
call: fun(libname, pkgname)
error: lazy-load database '/Library/Frameworks/R.framework/Versions/4.3-arm64/Resources/library/cachem/R/cachem.rdb' is corrupt
In addition: Warning messages:
1: In fun(libname, pkgname) : restarting interrupted promise evaluation
2: In fun(libname, pkgname) : internal error -3 in R_decompress1
Hm. This looks like a corrupted install, I would restart R to a clean session and try installing again
Now I have this issue...
> espn_conn <- espn_connect(season = 2023, league_id = 352072624)
> mfl_sim <- ff_simulate(conn = espn_conn, n_seasons = 100)
── Starting simulation 2024-05-20 18:28:21.576716 ─────────────────────────────────────────────────────────────────────────────────
✔ Importing data ... done
Error in espn_getendpoint_raw(conn, url_query, xff) :
object 'parsed' not found
In addition: Warning message:
ESPN API did not return json while calling https://fantasy.espn.com/apis/v3/games/ffl/seasons/2023/segments/0/leagues/352072624?view=mSettings
Hrm. ESPN API had some issues earlier, will need to investigate
Sounds good. Thanks
Is that a fix?