Hi,
I've scratched my head all day.... looking for some help to produce df_final from df
Thanks
# data frame I get after cleaning my data
df_ <- tibble(
game_id = as.numeric(c("24786", "24786", "24786", "24786", "24786", "24786",
"24794", "24794", "24794", "24794", "24794", "24794")),
team_id = as.numeric(c("6", "19", "19", "6", "19", "19",
"12", "12", "12", "12", "6", "6"))
)
# data frame I want
df_final <- tibble(
game_id = as.numeric(c("24786", "24786",
"24794", "24794")),
team_id = as.numeric(c("6", "19",
"6", "12")),
GF = as.numeric(c("2", "4", "2", "4")),
GA = as.numeric(c("4", "2", "4", "2"))
)