e-letter
2009-Oct-26 07:25 UTC
[R] exclude data for boxplot stats using mathematical operator
Readers, I have a data set as follows: 1,1 2,2 3,3 4,4 5,3 6,2 7,-10 8,-9 9,-3 10,2 11,3 12,4 13,5 14,4 15,3 16,2 17,1 I entered this data set using the command 'read.csv'. I want to exclude values fewer than zero in column 2 so then I tried the following command: boxplot.stats(x[>0,2],do.conf=FALSE) Error: syntax error, unexpected GT, expecting ',' in "boxplot.stats(x[>" Any help please? Yours, rhelp at conference.jabber.org r 251
Stephan Kolassa
2009-Oct-26 07:43 UTC
[R] exclude data for boxplot stats using mathematical operator
Try this: boxplot.stats(x[x[,2]>0,2],do.conf=FALSE) HTH, Stephan e-letter schrieb:> Readers, > > I have a data set as follows: > > 1,1 > 2,2 > 3,3 > 4,4 > 5,3 > 6,2 > 7,-10 > 8,-9 > 9,-3 > 10,2 > 11,3 > 12,4 > 13,5 > 14,4 > 15,3 > 16,2 > 17,1 > > I entered this data set using the command 'read.csv'. I want to > exclude values fewer than zero in column 2 so then I tried the > following command: > > boxplot.stats(x[>0,2],do.conf=FALSE) > Error: syntax error, unexpected GT, expecting ',' in "boxplot.stats(x[>" > > Any help please? > > Yours, > > rhelp at conference.jabber.org > r 251 > > ______________________________________________ > R-help at r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. >
John Kane
2009-Oct-26 19:02 UTC
[R] exclude data for boxplot stats using mathematical operator
Perhaps subset the data first? subset(x, x[,2] >=0) --- On Mon, 10/26/09, e-letter <inpost at gmail.com> wrote:> From: e-letter <inpost at gmail.com> > Subject: [R] exclude data for boxplot stats using mathematical operator > To: r-help at r-project.org > Received: Monday, October 26, 2009, 3:25 AM > Readers, > > I have a data set as follows: > > 1,1 > 2,2 > 3,3 > 4,4 > 5,3 > 6,2 > 7,-10 > 8,-9 > 9,-3 > 10,2 > 11,3 > 12,4 > 13,5 > 14,4 > 15,3 > 16,2 > 17,1 > > I entered this data set using the command 'read.csv'. I > want to > exclude values fewer than zero in column 2 so then I tried > the > following command: > > boxplot.stats(x[>0,2],do.conf=FALSE) > Error: syntax error, unexpected GT, expecting ',' in > "boxplot.stats(x[>" > > Any help please? > > Yours, > > rhelp at conference.jabber.org > r 251 > > ______________________________________________ > R-help at r-project.org > mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, > reproducible code. >__________________________________________________________________ [[elided Yahoo spam]]