0

I'm new at R. I have an csv file with 4 columns. One is the game name, the second one is the room its installed, the month and the last one is how many times it was played. Could you guys help me create a serie plot of how many times each game were played along the months ? Thank you!

data:

     game   Room    Month   Timesplayed
     A        IND         1         5
     A        FOR         1         6
     A        TYH         1         4
     B        IND         1         3
     B        FOR         1         2
     C        TYH         1         1
     C        IND         1         4
     E        IND         1         2
     E        FOR         1         1
     F        KUY         1         2
     F        TYH         1         5
     F        FOR         1         6
     F        IND         1         3
     A        IND         2         2
     A        FOR         2         1
     A        TYH         2         0
     B        IND         2         7
     B        FOR         2         10
     C        TYH         2         4
     C        IND         2         2
     E        IND         2         3
     E        FOR         2         5
     F        KUY         2         6
     F        TYH         2         7         
     F        FOR         2         2
     F        IND         2         1
     A        IND         3         9
     A        FOR         3         0
     A        TYH         3         3
     B        IND         3         4
     B        FOR         3         2
     C        TYH         3         1
     C        IND         3         7
     E        IND         3         9
     E        FOR         3         4
     F        KUY         3         3
     F        TYH         3         6
     F        FOR         3         2
     F        IND         3         2

I tryied plot.ts(percent2), but it shows Erro em plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, : cannot plot more than 10 series as "multiple"

karips
  • 151
  • 1
  • 1
  • 11
  • I tryied plot.ts(percent2), but it shows Erro em plotts(x = x, y = y, plot.type = plot.type, xy.labels = xy.labels, : cannot plot more than 10 series as "multiple" – karips Apr 23 '13 at 13:59
  • 1
    Not without any data we can't. Read this: http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – Matthew Lundberg Apr 23 '13 at 14:01

1 Answers1

0

If your data frame is df and using your columns "game, Month, and Timesplayed", you can try ggplot(df, aes(x = Month, y = Timesplayed, fill=game)) + geom_bar(stat="identity")

More here: http://docs.ggplot2.org/current/geom_bar.html

harkmug
  • 2,725
  • 22
  • 26
  • `gplot(df, aes(x = Month, y = Timesplayed, colour=game, group=game)) + geom_line()`. You may need to make some adjustments to axis etc. See: http://docs.ggplot2.org/current/geom_line.html – harkmug Apr 23 '13 at 14:43
  • In ggplot, it is preferred to make changes to the dataframe before plotting. So you could pass `df[game=="A",]`, for example. Another option is to plot each game seperately using `facet_wrap`: `ggplot(df, aes(x = Month, y = Timesplayed, colour=game, group=game)) + geom_line() + facet_wrap(~game)` – harkmug Apr 24 '13 at 13:19