Skip to content

Commit

Permalink
Merge pull request #86 from SCasanova/devtest
Browse files Browse the repository at this point in the history
Finish Introduction vignette and bring all docs to 1.0.0
  • Loading branch information
SCasanova authored Jun 20, 2023
2 parents 1c0abeb + 68a760d commit 2547a92
Show file tree
Hide file tree
Showing 56 changed files with 639 additions and 284 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: f1dataR
Title: F1 Data in R
Version: 0.4.2
Version: 1.0.0
Authors@R:
c(person(given = "Santiago",
family = "Casanova",
Expand Down
4 changes: 2 additions & 2 deletions R/load_driver_telemetry.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

load_driver_telemetry <- function(season = get_current_season, round =1, session = 'R', driver, fastest_only = FALSE, log_level="WARNING", race = lifecycle::deprecated()){
if (lifecycle::is_present(race)) {
lifecycle::deprecate_warn("0.4.1", "load_driver_telemetry(race)", "load_driver_telemetry(round)")
lifecycle::deprecate_warn("1.0.0", "load_driver_telemetry(race)", "load_driver_telemetry(round)")
round <- race
}
load_race_session("session", season = season, round = round, session = session, log_level = log_level)
Expand Down Expand Up @@ -60,6 +60,6 @@ load_driver_telemetry <- function(season = get_current_season, round =1, session


get_driver_telemetry <- function(season = get_current_season(), round =1, session = 'R', driver, fastest_only = FALSE, log_level="WARNING", race = lifecycle::deprecated()){
lifecycle::deprecate_warn("0.4.1", "get_driver_telemetry()", "load_driver_telemetry()")
lifecycle::deprecate_warn("1.0.0", "get_driver_telemetry()", "load_driver_telemetry()")
load_driver_telemetry(season = season, round = round, session = session, driver = driver, fastest_only = fastest_only, log_level = log_level, race = race)
}
2 changes: 1 addition & 1 deletion R/load_laps.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

.load_laps <- function(season = 'current', round = 'last', race = lifecycle::deprecated()){
if (lifecycle::is_present(race)) {
lifecycle::deprecate_warn("0.4.1", "load_laps(race)", "load_laps(round)")
lifecycle::deprecate_warn("1.0.0", "load_laps(race)", "load_laps(round)")
round <- race
}
if(season != 'current' & (season < 1996 | season > get_current_season())){
Expand Down
2 changes: 1 addition & 1 deletion R/load_pitstops.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

.load_pitstops <- function(season = 'current', round ='last', race = lifecycle::deprecated()){
if (lifecycle::is_present(race)) {
lifecycle::deprecate_warn("0.4.1", "load_pitstops(race)", "load_pitstops(round)")
lifecycle::deprecate_warn("1.0.0", "load_pitstops(race)", "load_pitstops(round)")
round <- race
}
if(season != 'current' & (season < 2011 | season > get_current_season())){
Expand Down
2 changes: 1 addition & 1 deletion R/load_race_session.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

load_race_session <- function(obj_name="session", season = get_current_season(), round =1, session = 'R', log_level = "WARNING", race = lifecycle::deprecated()){
if (lifecycle::is_present(race)) {
lifecycle::deprecate_warn("0.4.1", "load_race_session(race)", "load_race_session(round)")
lifecycle::deprecate_warn("1.0.0", "load_race_session(race)", "load_race_session(round)")
round <- race
}
if(season != 'current' & (season < 2018 | season > get_current_season())){
Expand Down
2 changes: 1 addition & 1 deletion R/load_session_laps.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

load_session_laps <- function(season = get_current_season(), round = 1, session = 'R', log_level = "WARNING", add_weather=F, race = lifecycle::deprecated()){
if (lifecycle::is_present(race)) {
lifecycle::deprecate_warn("0.4.1", "load_session_laps(race)", "load_session_laps(round)")
lifecycle::deprecate_warn("1.0.0", "load_session_laps(race)", "load_session_laps(round)")
round <- race
}

Expand Down
4 changes: 2 additions & 2 deletions R/plot_fastest.R
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ plot_fastest <- function(season = get_current_season(), round = 1, session = 'R'

message("If the session has not been loaded yet, this could take a minute\n\n")
if (lifecycle::is_present(race)) {
lifecycle::deprecate_warn("0.4.1", "plot_fastest(race)", "plot_fastest(round)")
lifecycle::deprecate_warn("1.0.0", "plot_fastest(race)", "plot_fastest(round)")
round <- race
}

Expand Down Expand Up @@ -56,7 +56,7 @@ plot_fastest <- function(season = get_current_season(), round = 1, session = 'R'
}

if(color == 'gear'){
ggplot2::ggplot(driver_data, ggplot2::aes(.data$x, .data$y, color = as.factor(.data$n_gear), group = .data$time)) +
ggplot2::ggplot(driver_data, ggplot2::aes(.data$x, .data$y, color = as.factor(.data$n_gear), group = NA)) +
ggplot2::geom_path(linewidth = 4, lineend = 'round') +
ggplot2::scale_color_manual(name = 'Gear',
values = c("#BC3C29", "#0072B5", "#E18727", "#20854E", "#7876B1", "#6F99AD", "#FFDC91", "#EE4C97"),
Expand Down
74 changes: 37 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,41 +96,41 @@ this will improve to only a couple of seconds
``` r
load_driver_telemetry(2022, round = 4, driver = 'PER')
#> # A tibble: 42,415 × 19
#> date session_time driver_ahead distance_…¹ time
#> <dttm> <dttm> <chr> <dbl> <dttm>
#> 1 2022-04-24 15:03:03 NA "" 0.0889 NA
#> 2 2022-04-24 15:03:03 NA "" 0.0889 NA
#> 3 2022-04-24 15:03:03 NA "" 0.0889 NA
#> 4 2022-04-24 15:03:03 NA "6" 0.0889 NA
#> 5 2022-04-24 15:03:03 NA "6" 0.0593 NA
#> 6 2022-04-24 15:03:03 NA "6" 0.0296 NA
#> 7 2022-04-24 15:03:03 NA "77" 0 NA
#> 8 2022-04-24 15:03:04 NA "77" 0.0222 NA
#> 9 2022-04-24 15:03:04 NA "6" 0.0444 NA
#> 10 2022-04-24 15:03:04 NA "6" 0.0444 NA
#> # … with 42,405 more rows, 14 more variables: rpm <dbl>, speed <dbl>,
#> # n_gear <dbl>, throttle <dbl>, brake <lgl>, drs <dbl>, source <chr>,
#> # relative_distance <dbl>, status <chr>, x <dbl>, …, and abbreviated variable
#> # name ¹​distance_to_driver_ahead
#> date session_time time rpm speed n_gear throt…¹ brake drs
#> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl> <dbl>
#> 1 2022-04-24 15:03:03 3723. 0 9883 0 2 16 FALSE 1
#> 2 2022-04-24 15:03:03 3723. 0.16 9889 0 2 16 FALSE 1
#> 3 2022-04-24 15:03:03 3724. 0.291 9245 0 2 16 FALSE 1
#> 4 2022-04-24 15:03:03 3724. 0.48 8602 0 2 16 FALSE 1
#> 5 2022-04-24 15:03:03 3724. 0.531 8228 2 2 16 FALSE 1
#> 6 2022-04-24 15:03:03 3724. 0.571 7855 4 2 16 FALSE 1
#> 7 2022-04-24 15:03:03 3724. 0.64 7482 7 2 16 FALSE 1
#> 8 2022-04-24 15:03:04 3724. 0.79 6502 10 2 16 FALSE 1
#> 9 2022-04-24 15:03:04 3724. 0.92 5522 13 2 16 FALSE 1
#> 10 2022-04-24 15:03:04 3724. 1.01 5072 15 2 16 FALSE 1
#> # … with 42,405 more rows, 10 more variables: source <chr>,
#> # relative_distance <dbl>, status <chr>, x <dbl>, y <dbl>, z <dbl>,
#> # distance <dbl>, driver_ahead <chr>, distance_to_driver_ahead <dbl>,
#> # driver_code <chr>, and abbreviated variable name ¹​throttle

load_driver_telemetry(2018, round = 7,'Q', 'HAM', fastest_only = T)
#> # A tibble: 534 × 19
#> date session_time driver_ahead distance_…¹ time
#> <dttm> <dttm> <chr> <dbl> <dttm>
#> 1 2018-06-09 20:59:18 NA "" 383. NA
#> 2 2018-06-09 20:59:18 NA "" 383. NA
#> 3 2018-06-09 20:59:18 NA "" 383. NA
#> 4 2018-06-09 20:59:19 NA "7" 383. NA
#> 5 2018-06-09 20:59:19 NA "7" 379. NA
#> 6 2018-06-09 20:59:19 NA "7" 375. NA
#> 7 2018-06-09 20:59:19 NA "7" 370. NA
#> 8 2018-06-09 20:59:19 NA "7" 366. NA
#> 9 2018-06-09 20:59:19 NA "7" 362. NA
#> 10 2018-06-09 20:59:19 NA "7" 358. NA
#> # … with 524 more rows, 14 more variables: rpm <dbl>, speed <dbl>,
#> # n_gear <dbl>, throttle <dbl>, brake <lgl>, drs <dbl>, source <chr>,
#> # relative_distance <dbl>, status <chr>, x <dbl>, …, and abbreviated variable
#> # name ¹​distance_to_driver_ahead
#> date session_time time rpm speed n_gear throt…¹ brake drs
#> <dttm> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <lgl> <dbl>
#> 1 2018-06-09 20:59:18 3788. 0 10674 297 8 100 FALSE 12
#> 2 2018-06-09 20:59:18 3788. 0.016 10704 298 8 100 FALSE 12
#> 3 2018-06-09 20:59:18 3788. 0.043 10762 299 8 100 FALSE 12
#> 4 2018-06-09 20:59:19 3788. 0.256 10820 301 8 100 FALSE 12
#> 5 2018-06-09 20:59:19 3788. 0.343 10847 302 8 100 FALSE 12
#> 6 2018-06-09 20:59:19 3788. 0.496 10875 303 8 100 FALSE 12
#> 7 2018-06-09 20:59:19 3789. 0.643 10921 303 8 100 FALSE 12
#> 8 2018-06-09 20:59:19 3789. 0.736 10967 304 8 100 FALSE 12
#> 9 2018-06-09 20:59:19 3789. 0.943 10990 305 8 100 FALSE 12
#> 10 2018-06-09 20:59:19 3789. 0.976 11014 306 8 100 FALSE 12
#> # … with 524 more rows, 10 more variables: source <chr>,
#> # relative_distance <dbl>, status <chr>, x <dbl>, y <dbl>, z <dbl>,
#> # distance <dbl>, driver_ahead <chr>, distance_to_driver_ahead <dbl>,
#> # driver_code <chr>, and abbreviated variable name ¹​throttle
```

### Lap-by-Lap information
Expand Down Expand Up @@ -187,12 +187,12 @@ options(f1dataR.cache = 'path/to/directory')

## Loaded Data

The package also includes a static data frame for all current constructors. Complete with team colors and logo.
The package also includes a static data frame for all current drivers
and their respective constructors. Complete with team colors, logo and
driver number logo.

``` r
constructor_data %>% colnames()
#> [1] "driver_id" "full_name" "driver_code"
#> [4] "constructor_id" "constructor_name" "constructor_color"
#> [7] "constructor_color2" "constructor_logo" "driver_number"
#> [10] "number_image" "season"
#> [1] "constructor_id" "constructor_color" "constructor_color2"
#> [4] "constructor_logo"
```
4 changes: 2 additions & 2 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/articles/index.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2547a92

Please sign in to comment.