Skip to contents

This function retrieves the dream team (best performing players) for a specific gameweek in the Fantasy Premier League using the official API. You can specify the gameweek ID to get the dream team for a specific gameweek. If the gameweek ID is not provided, the function will retrieve the dream team for the current gameweek.

Usage

fpl_dreamteam(gameweek_id = NULL)

Arguments

gameweek_id

The ID of the gameweek for which to retrieve the dream team. If not provided, the dream team for the current gameweek will be retrieved.

Value

A tibble (data frame) with the following columns:

player

The names of the players in the dream team.

points

The points scored by the player.

team

The players' team.

position

The players' position.

Examples

# Get the dream team for the current gameweek
fpl_dreamteam()
#>  The dream team for Gameweek 4 is:
#> # A tibble: 11 × 4
#>    player           points team  position
#>    <chr>             <int> <chr> <chr>   
#>  1 A.Becker              8 LIV   GKP     
#>  2 Alexander-Arnold     12 LIV   DEF     
#>  3 Zouma                11 WHU   DEF     
#>  4 Boly                  9 NFO   DEF     
#>  5 Son                  20 TOT   MID     
#>  6 Gilmour              11 BHA   MID     
#>  7 Rice                 10 ARS   MID     
#>  8 Solomon              10 TOT   MID     
#>  9 Haaland              20 MCI   FWD     
#> 10 Ferguson             17 BHA   FWD     
#> 11 J.Alvarez            14 MCI   FWD     

# Get the dream team for a specific gameweek (e.g., gameweek 5)
# fpl_dreamteam(gameweek_id = 5)