[R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread guox
I am wondering if you know how to return by function or show in boxplot, the indexes of unusual points, such as, points that are outside the box or in [Q3+1.5IQR,Max]. For example, boxplot(c(4,rnorm(20),8)) There are 2 unusual points 4 and 8. How to show the indexes of 4 and 8 in the boxplot or

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread Henrique Dallazuanna
Try this: bp - boxplot(c(4,rnorm(20),8)) bp$out On Wed, Sep 9, 2009 at 4:25 PM, g...@ucalgary.ca wrote: I am wondering if you know how to return by function or show in boxplot, the indexes of unusual points, such as, points that are outside the box or in [Q3+1.5IQR,Max]. For example,

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread jim holtman
boxplot returns a dataframe that has the values in it at $out: x - boxplot(c(4,rnorm(20),8)) x $stats [,1] [1,] -1.5364498 [2,] -0.5282799 [3,] -0.1398736 [4,] 0.3065579 [5,] 1.3430388 $n [1] 22 $conf [,1] [1,] -0.4210947 [2,] 0.1413474 $out [1] 4 8 $group [1] 1 1

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread guox
Thank you very much. But it seems that x$out returns the values not the indexes of the values (1,22). -james boxplot returns a dataframe that has the values in it at $out: x - boxplot(c(4,rnorm(20),8)) x $stats [,1] [1,] -1.5364498 [2,] -0.5282799 [3,] -0.1398736 [4,]

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread jim holtman
use 'match' to get the indices; match(x$out, yourData) On Wed, Sep 9, 2009 at 4:07 PM, g...@ucalgary.ca wrote: Thank you very much. But it seems that x$out returns the values not the indexes of the  values (1,22). -james boxplot returns a dataframe that has the values in it at $out: x -

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread Jorge Ivan Velez
Hi James, If that's the case, then set.seed(123) x - c(4,rnorm(20),8) bp - boxplot(x) bp$out # [1] 4 8 which(x %in% bp$out) # [1] 1 22 is what you are looking for. :-) HTH, Jorge On Wed, Sep 9, 2009 at 4:07 PM, g...@ucalgary.ca wrote: Thank you very much. But it seems that x$out returns

Re: [R] How to return/show the indexes of unusual points in boxplot?

2009-09-09 Thread guox
Thanks for your help. -jmaes Hi James, If that's the case, then set.seed(123) x - c(4,rnorm(20),8) bp - boxplot(x) bp$out # [1] 4 8 which(x %in% bp$out) # [1] 1 22 is what you are looking for. :-) HTH, Jorge On Wed, Sep 9, 2009 at 4:07 PM, g...@ucalgary.ca wrote: Thank you