Untitled
1 month ago in Plain Text
#Adding home goals per team per season
B <- FullEPL %>%
group_by(Seasons,HomeTeam) %>%
mutate(Home_goals = sum(FTHG))

#adding away goals per team per season
C <- B %>%
group_by(Seasons,AwayTeam) %>%
mutate(Away_goals = sum(FTAG))

#I can keep adding the colums i need from the previous tables made

Test <- aggregate (x= FullEPL$FTAG,
by= list(FullEPL$AwayTeam),
by= list(FullEPL$Seasons),
FUN=sum)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16