0

I will further explain with a simple example If I had a dataset as follows:

Team   Score
Blue       4
Blue       8
Green      8
Orange     7
Blue       4
Red        5
Red        4
Orange     10
Blue       3
Green      8
Green      5

I want do to something to get the means that expresses:

mean(Score[Team=Blue])
mean(Score[Team=Green])...

I want to be able to do it all at once.

David Arenburg
  • 91,361
  • 17
  • 137
  • 196
Kyle
  • 91
  • 3
  • Please provide us a code-snippet of what you have tried so far – Nevermore Mar 08 '17 at 08:17
  • http://stackoverflow.com/help/how-to-ask – ztl Mar 08 '17 at 08:20
  • Thank you for the link to the answer. As far as what I've gotten to work is this: team_Names<-levels(team) i=0 while (i<5){ i=i+1 mean(Stock.p[Team==team_Names[i]])->tnames print(tnames) } it works, but I don't know how to save the iterations as a vector @Nevermore – Kyle Mar 08 '17 at 08:31

0 Answers0