2013-04-23 64 views
0

我是新的R.我有4列的csv文件。一个是游戏名称,第二个是它安装的房间,一个月,最后一个是玩过的次数。你们能帮我创建一个关于每个月中每场比赛有多少次的系列赛吗?谢谢!R系列情节与团体

数据:

 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 

我tryied plot.ts(percent2),但它示出了EM ERRO plotts(X = X,Y = Y,plot.type = plot.type,xy.labels = XY .labels,:不能积十余系列“多”

+0

我tryied plot.ts(percent2),但它示出了EM ERRO plotts(X = X,Y = Y,plot.type = plot.type,xy.labels = xy.labels,: 可以不积超过10系列作为“多个” – karips 2013-04-23 13:59:27

+1

不是没有任何数据,我们不能。阅读此:http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – 2013-04-23 14:01:18

+0

编辑数据。 – karips 2013-04-23 14:13:42

回答

0

如果数据帧是df和使用列“的游戏,月和Timesplayed”,你可以尝试ggplot(df, aes(x = Month, y = Timesplayed, fill=game)) + geom_bar(stat="identity")

这里更多:http://docs.ggplot2.org/current/geom_bar.html

+0

这正是我想要的,谢谢!我怎样才能有线图? – karips 2013-04-23 14:29:33

+0

'gplot(df,aes(x = Month,y = Timesplayed,color = game,group = game))+ geom_line()'。您可能需要做一些调整,轴等。参见:http://docs.ggplot2.org/current/geom_line.html – harkmug 2013-04-23 14:43:50

+0

如果制定出适合你,你可以接受的答案是:http://meta.stackexchange。 com/a/5235谢谢! – harkmug 2013-04-23 15:19:12