convert_results returns a dataframe containing the results in long format.

convert_results(results)

Arguments

results

A dataframe that has been returned from get_match_results

Value

A data frame with match results where each row is a team-match combination

Details

The standard results returned by afltables.com will be in wide format. This is useful for game based analysis but less so for team based ones. This function converts the data into long format for easier analysis.

Examples

results <- get_match_results()
#> Warning: package ‘bindrcpp’ was built under R version 3.4.4
convert_results(results)
#> # A tibble: 30,760 x 13 #> Game Date Round Venue Margin Season Round.Type Round.Number Status #> <dbl> <date> <chr> <chr> <dbl> <dbl> <chr> <int> <chr> #> 1 1. 1897-05-08 R1 Brunswi… 33. 1897. Regular 1 Home #> 2 1. 1897-05-08 R1 Brunswi… -33. 1897. Regular 1 Away #> 3 2. 1897-05-08 R1 Victori… 25. 1897. Regular 1 Home #> 4 2. 1897-05-08 R1 Victori… -25. 1897. Regular 1 Away #> 5 3. 1897-05-08 R1 Corio O… -23. 1897. Regular 1 Home #> 6 3. 1897-05-08 R1 Corio O… 23. 1897. Regular 1 Away #> 7 4. 1897-05-08 R1 Lake Ov… -17. 1897. Regular 1 Home #> 8 4. 1897-05-08 R1 Lake Ov… 17. 1897. Regular 1 Away #> 9 5. 1897-05-15 R2 Lake Ov… 4. 1897. Regular 2 Home #> 10 5. 1897-05-15 R2 Lake Ov… -4. 1897. Regular 2 Away #> # ... with 30,750 more rows, and 4 more variables: Behinds <chr>, Goals <chr>, #> # Points <chr>, Team <chr>