Skip to content

Commit

Permalink
try f
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyelhabr committed Jun 3, 2023
1 parent f0fa69b commit cd293ed
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v2
- name: Package Installation
run: Rscript -e 'install.packages("remotes")'
run: Rscript -e 'install.packages(c("remotes", "purrr"))'
- name: Install worldfootballR
run: Rscript -e 'remotes::install_github("JaseZiv/worldfootballR")'
- name: Run script
Expand Down
18 changes: 14 additions & 4 deletions test.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
library(worldfootballR)
library(purrr)
packageVersion("worldfootballR")
league_one_injuries <- tm_league_injuries(country_name = "",league_url = "https://www.transfermarkt.com/league-one/startseite/wettbewerb/GB3")
league_one_injuries
hazard_injuries <- tm_player_injury_history(player_urls = "https://www.transfermarkt.com/eden-hazard/profil/spieler/50202")
hazard_injuries

try_f <- function(f, ...) {
fs <- safely(f, quiet = FALSE)
res <- fs(...)
if (!is.null(res$error)) {
print(res$error)
}
res$result
}

try_f(tm_matchday_table, country_name="England", start_year="2021", matchday=1)
try_f(tm_league_injuries, country_name = "",league_url = "https://www.transfermarkt.com/league-one/startseite/wettbewerb/GB3")
try_f(tm_player_injury_history, player_urls = "https://www.transfermarkt.com/eden-hazard/profil/spieler/50202")

0 comments on commit cd293ed

Please sign in to comment.