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

Load functions #130

Merged
merged 7 commits into from
Jun 3, 2022
Merged

Load functions #130

merged 7 commits into from
Jun 3, 2022

Conversation

JaseZiv
Copy link
Owner

@JaseZiv JaseZiv commented Jun 2, 2022

No description provided.

@JaseZiv JaseZiv requested a review from tonyelhabr June 2, 2022 07:11
@codecov-commenter
Copy link

codecov-commenter commented Jun 2, 2022

Codecov Report

Merging #130 (6fe808c) into main (4343b9f) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #130      +/-   ##
==========================================
+ Coverage   87.93%   88.02%   +0.09%     
==========================================
  Files          39       41       +2     
  Lines        2784     2806      +22     
==========================================
+ Hits         2448     2470      +22     
  Misses        336      336              
Impacted Files Coverage Δ
R/fotmob_stats.R 94.73% <ø> (ø)
R/internals_loading.R 100.00% <100.00%> (ø)
R/load_fb.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4343b9f...6fe808c. Read the comment docs.

@JaseZiv
Copy link
Owner Author

JaseZiv commented Jun 2, 2022

Since when did checks fail for warnings?!

Tried fixing this issue with stat_name But nothing seems to solve it?

test_df <- load_match_results(country = "ENG", gender = "M", season_end_year = 2022, tier="1st")
# test the functions returns the data
expect_type(test_df, "list")

Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe add expect_false(nrow(test_df) == 0)?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Yeah I like it. I'll make the changes


This is the load function equivalent of `get_match_results()`.

```{r load_match_results, eval=FALSE}
Copy link
Collaborator

Choose a reason for hiding this comment

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

why eval=FALSE?

Copy link
Owner Author

Choose a reason for hiding this comment

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

Because the vignette loads the library at the start, then fails to recognise these new functions as they're not yet deployed to the library. So once the version gets updated, then I go in and rebuild that one article and set eval=TRUE...

Unless I've got that completely wrong?

Copy link
Collaborator

Choose a reason for hiding this comment

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

hmm i think you can run devtools::install() prior to running pkgdown::build_site() to ensure that the new functions are available

Copy link
Collaborator

Choose a reason for hiding this comment

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

if we weren't ignoring vignettes with .Rbuildignore, I believe the functions would be available to the vignettes anyways. i think the package gets built before the vignettes

R/load_fb.R Outdated
load_match_results <- function(country, gender, season_end_year, tier) {
dat_urls <- paste0("https://github.com/JaseZiv/worldfootballR_data/blob/master/data/match_results/", country, "_match_results.rds?raw=true")

collect_date <- .file_reader("https://github.com/JaseZiv/worldfootballR_data/blob/master/data/match_results/scrape_time_match_results.rds?raw=true")
Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm not sure i like this paradigm (having a separate data set for scrape times). what if we tried saving the timestamp as an attribute with the data set? e.g. https://github.com/nflverse/nflfastR-data/blob/91bb21f44596b474f2c4390e348c8ac44c24879c/R/save_stats.R#L13 I'm not totally sure if this is possible with RDS (i think it probably is)

Copy link
Owner Author

Choose a reason for hiding this comment

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

Have addressed this in 6fe808c

dat_df <- dat_df %>%
dplyr::filter(.data$Season_End_Year %in% season_end_year)

cli::cli_alert("Data last updated {attr(dat_df, 'scrape_timestamp')} UTC")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice!

Copy link
Collaborator

@tonyelhabr tonyelhabr left a comment

Choose a reason for hiding this comment

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

the other things i've commented on aren't blockers

@JaseZiv JaseZiv merged commit ab78017 into main Jun 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants