Suppose we are interested in listing the top FPL performers by FPL goals and assists? Again, we take the first 25 gameweeks of the 18/19 season as an example.

First we fetch the gameweek-by-gameweek details of ALL players using get_player_details:

library(fplscrapR)

df <- get_player_details(season=18) # this may take a while to load as it fetches ALL player details

Next we use dplyr and ggplot2 to transform and plot the data, showing the top performers:

library(dplyr)
library(ggplot2)
df %>%
  filter(round %in% 1:25) %>% # filtering for the GWs we are interested in
  select(playername,goals_scored,assists) %>% # selecting the relevant columns
  group_by(playername) %>% # transformation to group and summarize the performance at the 'playername' variable level
  summarize_all(sum) %>%
  mutate("involvements"=goals_scored+assists) %>% # adding a new variable that sums the goals scored and assists
  arrange(-involvements) %>%  # ordering (arranging) the table by top involvements
  slice(1:20) # showing the top20 only
## # A tibble: 20 x 4
##    playername                    goals_scored assists involvements
##    <chr>                                <int>   <int>        <int>
##  1 Mohamed Salah                           16       8           24
##  2 Eden Hazard                             12      10           22
##  3 Raheem Sterling                         10      12           22
##  4 Sergio Agüero                           14       8           22
##  5 Pierre-Emerick Aubameyang               15       6           21
##  6 Harry Kane                              14       6           20
##  7 Leroy Sané                               8      11           19
##  8 Callum Wilson                           10       8           18
##  9 Paul Pogba                               9       9           18
## 10 Alexandre Lacazette                      9       8           17
## 11 Heung-Min Son                           10       7           17
## 12 Marcus Rashford                          9       7           16
## 13 Raúl Jiménez                             9       7           16
## 14 Roberto Firmino                          9       5           14
## 15 Ryan Fraser                              5       9           14
## 16 Aleksandar Mitrovic                     10       3           13
## 17 Sadio Mané                              11       2           13
## 18 Christian Eriksen                        4       8           12
## 19 Felipe Anderson Pereira Gomes            8       4           12
## 20 Gylfi Sigurdsson                         9       3           12