0

I have a EPL matches data loaded into R consisting of 4 columns (Home Team, Full Time Home Team Goals, Away Team, Full Time Away Team Goals).

Home Team and Away Team consists of a total of 20 football clubs. I would like to plot a graph showing the total number of goals (both home team goals and away team goals) scored by each football club. May I know the easiest way to go about this?

I'm new to R and can't quite figure out which way would be the best. Do I create a data frame first and then plot a graph? A part of my data as shown below; My data

Phil
  • 7,287
  • 3
  • 36
  • 66
newbieR
  • 1
  • 1
  • 1
    Welcome to StackOverflow! Please read the info about [how to ask a good question][1] [1]: https://stackoverflow.com/help/how-to-ask and [how to give a reproducible example][2] [2]:https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example .This will make it much easier for others to help you. – RobertoT May 05 '22 at 09:19
  • Without having the data, I would say that the easiest way is to create a data frame and create a new column grouping first by team name and adding up both home and away goals. Then you can just plot the total goals by each team. If you provide a data example I can show you a code example. – RobertoT May 05 '22 at 09:21

0 Answers0