Tidyverse solution:
df = tibble::tibble(
player = c('a','b', 'a','b', 'a','c'),
year = c(2017, 2017, 2018, 2018, 2019,2019),
targets= c(113,114,115,116,115,100),
fpts = c(147,148,132,144,130,12)
)
df
#> # A tibble: 6 x 4
#> player year targets fpts
#> <chr> <dbl> <dbl> <dbl>
#> 1 a 2017 113 147
#> 2 b 2017 114 148
#> 3 a 2018 115 132
#> 4 b 2018 116 144
#> 5 a 2019 115 130
#> 6 c 2019 100 12
tidyr::pivot_wider(df,id_cols=player,names_from=year,values_from=c(fpts,targets))
#> # A tibble: 3 x 7
#> player fpts_2017 fpts_2018 fpts_2019 targets_2017 targets_2018 targets_2019
#> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 a 147 132 130 113 115 115
#> 2 b 148 144 NA 114 116 NA
#> 3 c NA NA 12 NA NA 100
Created on 2020-06-04 by the reprex package (v0.3.0)