Open jimmyday12 opened 2 years ago
Hey @DataByJosh - just reviewing some old tickets and noticed this one. No stress or pressure, just thought I'd ping to see if you had a chance to look into this at all?
Hey @jimmyday12 - apologies, has been a hectic couple of months and just never quite made it to the top of the priorities pile. Moving house at the moment but should have some time to tackle it in February.
No stress at all @DataByJosh - I have been in the same boat. Thanks for the message!
Noting down some general steps and thoughts on adding the match chain data from @DataByJosh.
https://github.com/DataByJosh/AFL-Data/blob/main/AFLM_Match_Chains/Scraper.R
I'll assume you are relatively new to package dev based on our convo but if not, you can ignore some of this stuff!
Setup and Overview
usethis
package is massively helpful to setup a lot of boilerplateGeneral structure
/R
folder. In general - each main group of functions lives in one file. And there is a kind of parent function and then each 'source' (afl.com.au, footywire, afltables) has it's own function that the parent function callsfetch_lineup.R
file would be a good example to follow since it only has one source like you'll have here (https://github.com/jimmyday12/fitzRoy/blob/main/R/fetch_lineup.R)fetch_match_chains
andfetch_match_chains_afl
usethis::use_R("file_name.R")
and it'll set stuff upget_players
you could usefetch_players_afl
)Code stuff
dplyr::mutate
). I tend to find that the easiest thingusethis::use_package("pkgname")
and it will add it automatically. That does add an external dependancy so I try to not add too many more (and really need to purge some that are there!)dplyr
function, use.data$col_name
. I'm not exactly sure why but it throws warning messages in tests that CRAN doesn't like (e.g.df %>% dplyr::mutate(season = as.numeric(.data$season)
Tests
usethis::use_test("name_of_file.R"
will set it up for youWorkflow
load_all
regularly to run code and testdevtools::test
devtools::check
. The goal here is 0 notes, warnings or errors!mutate
. The way to get around this is to use.data$col_name
(for exampledf %>% dplyr::mutate(season = as.numeric(.data$season)
General comments
get_afl_cookie
which is in the AFL helpers file - https://github.com/jimmyday12/fitzRoy/blob/main/R/helpers-afl.Raccess_api
function is genius - I'd love if you added that to the AFL helpers file and at some point I might re-use that in other functions!Other stuff
NEWS.md
file outlining stuff you've addedusethis::use_vignette()
)