I started using R this week, so excuse me if this is a simple question. I want to create a dataframe from another dataframe that I created before. The first dataframe is:
HomeTeam AwayTeam Hgoals Agoals
Parma Juventus 0 1
Fiorentina Napoli 3 4
Udinese Milan 1 0
Cagliari Brescia 0 1
Roma Genoa 3 3
Sampdoria Lazio 0 3
Spal Atalanta 2 3
....
Now I want to create a dataframe that shows me the average of a team's home and away goals for the whole season. Something like this:
Team Hgoals(Avg) Agoals(Avg)
Parma 2.5 1.4
Fiorentina 1.3 2.1
Udinese 1.8 1.4