-
Notifications
You must be signed in to change notification settings - Fork 5
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_results() outputs inconsistent tibble structures #272
Comments
Hey, thanks for the bug report. Can you confirm if you're using the CRAN version of the package or the current development version? If your not sure, post the output from The reason I ask is because the data backend is changing very soon (next few weeks). The new backend might be more semantically consistent. Thanks. |
I think you meant to ask for Input:
Input:
Notice where it states |
Thanks again. Yeah, I think i meant If you have a chance, try install the dev version ( |
I got a chance to install the developer version of f1dataR then re-run my original script (without the tibble conditions) and the error was reproduced as follows: Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match
Calls: rbind -> rbind
Execution halted See version: Package: f1dataR
Title: Access Formula 1 Data
Version: 1.6.0.9000
Authors@R: c( person("Santiago", "Casanova", ,
"[email protected]", role = c("aut", "cre", "cph")),
person("Philip", "Bulsink", , "[email protected]", role =
"aut", comment = c(ORCID = "0000-0001-9668-2429")) )
Description: Obtain Formula 1 data via the 'Jolpica API'
<https://jolpi.ca> and the unofficial API
<https://www.formula1.com/en/timing/f1-live> via the 'fastf1'
'Python' library <https://docs.fastf1.dev/>.
Config/reticulate: list( packages = list( list(package = "fastf1", pip
= TRUE) ) )
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.3.1
Depends: R (>= 3.5.0), reticulate (>= 1.14),
Imports: glue, magrittr, tibble, jsonlite, httr2, memoise, janitor,
dplyr, tidyr, rlang, lifecycle, cli, rappdirs, cachem, withr
Suggests: ggplot2, httptest2, knitr, rmarkdown, testthat (>= 3.0.0),
VignetteBuilder: knitr
URL: https://scasanova.github.io/f1dataR/,
https://github.com/SCasanova/f1dataR
BugReports: https://github.com/SCasanova/f1dataR/issues
Config/testthat/edition: 3
RemoteType: github
RemoteHost: api.github.com
RemoteRepo: f1dataR
RemoteUsername: SCasanova
RemoteRef: HEAD
RemoteSha: 4f0c5a6e57035443ae54109b6470063203a34a56
GithubRepo: f1dataR
GithubUsername: SCasanova
GithubRef: HEAD
GithubSHA1: 4f0c5a6e57035443ae54109b6470063203a34a56
NeedsCompilation: no
Packaged: 2025-01-11 20:21:53 UTC; richa
Author: Santiago Casanova [aut, cre, cph], Philip Bulsink [aut]
(<https://orcid.org/0000-0001-9668-2429>)
Maintainer: Santiago Casanova <santiago.casanova@yahoo.com>
Built: R 4.4.2; ; 2025-01-11 20:21:56 UTC; windows
-- File: C:/Program Files/R/R-4.4.2/library/f1dataR/Meta/package.rds |
I haven't tested if the issue is endemic to the rest of the |
So I think i have it fixed, but there's some other issues blocking merging the fixed code into the repo (the automated test system doesn't like something about Python 3.12.8 right now). If you want, you could install the package with the changes I'm trying to merge in by running the following:
Note that when I test the package on my local machine, and when it's tested with Python versions other than 3.12 in the automated system, that everything passes ok. If you do test this version and it works, please let us know. |
Ran: library('f1dataR')
library('tibble')
results=tibble()
for(year in 1950:2024){
last_rnd=length(load_schedule(year)$round)
for(rnd in 1:last_rnd){
result_block=load_results(season=year,round=rnd)
result_block$season<-rep(year,nrow(result_block))
result_block$round<-rep(rnd,nrow(result_block))
results=rbind(results,result_block)
}
}
dir.create("data")
write.csv(results,file=paste0(getwd(),"/data/results.csv")) Obtained ! Failure at Jolpica with https:// connection. Retrying as http://.
✖ Error getting Jolpica data, http status code 429.
Too Many Requests
Error in rep(year, nrow(result_block)) : invalid 'times' argument
Execution halted
|
Sorry about the delay. The PR with a likely fix from @pbulsink has been merged |
The following code returns errors:
The cause behind the errors is that some outputs of
load_results
are inconsistent. For example, the tibble returned byload_result(season=1950)
in contrast with that ofload_results(season=2024)
:"time_sec"
) and"top_speed_kpt"
instead of"top_speed_kph"
.The intended file is written after executing an updated version of the above script incorporating code that addresses both conditions:
The text was updated successfully, but these errors were encountered: