Readers, For a data set 'x': 1 a 2 b 3 c 4 d 5 e 6 f 7 g 8 h 9 i How to select multiple subscripts to plot? For example to plot values 1:3 and 9:10: plot(x[1:3,1],x[,2]) and plot(x[9:10,1],x[,2]) into one plot? Yours, rhelpatconference.jabber.org r251
Hi see ?points or ?lines which you would surely found out if you bother to look at ?plot help page Regards Petr r-help-bounces at r-project.org napsal dne 13.01.2010 13:36:57:> Readers, > > For a data set 'x': > > 1 a > 2 b > 3 c > 4 d > 5 e > 6 f > 7 g > 8 h > 9 i > > How to select multiple subscripts to plot? For example to plot values > 1:3 and 9:10: > > plot(x[1:3,1],x[,2]) > > and > > plot(x[9:10,1],x[,2]) > > into one plot? > > Yours, > > rhelpatconference.jabber.org > r251 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html> and provide commented, minimal, self-contained, reproducible code.
On 13/01/2010 7:36 AM, e-letter wrote:> Readers, > > For a data set 'x': > > 1 a > 2 b > 3 c > 4 d > 5 e > 6 f > 7 g > 8 h > 9 i > > How to select multiple subscripts to plot? For example to plot values > 1:3 and 9:10: > > plot(x[1:3,1],x[,2]) > > and > > plot(x[9:10,1],x[,2]) > > into one plot?Neither of those will work, because your x[,2] vector is longer than the other vector. What you want is something like this: plot(col2 ~ col1, data=x[c(1:3, 9:10),]) where col1 and col2 are the names of those two columns. Duncan Murdoch