guox at ucalgary.ca
2009-Sep-09 19:25 UTC
[R] How to return/show the indexes of unusual points in boxplot?
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 return them by function? Thanks, -james
Henrique Dallazuanna
2009-Sep-09 19:49 UTC
[R] How to return/show the indexes of unusual points in boxplot?
Try this: bp <- boxplot(c(4,rnorm(20),8)) bp$out On Wed, Sep 9, 2009 at 4:25 PM, <guox@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, > > > 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 return them by function? > > Thanks, > > -james > > ______________________________________________ > R-help@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. >-- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
jim holtman
2009-Sep-09 19:55 UTC
[R] How to return/show the indexes of unusual points in boxplot?
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 $names [1] "1" On Wed, Sep 9, 2009 at 3:25 PM, <guox at 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, > >> 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 return them by function? > > Thanks, > > -james > > ______________________________________________ > 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?
guox at ucalgary.ca
2009-Sep-09 20:07 UTC
[R] How to return/show the indexes of unusual points in boxplot?
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,] 0.3065579 > [5,] 1.3430388 > > $n > [1] 22 > > $conf > [,1] > [1,] -0.4210947 > [2,] 0.1413474 > > $out > [1] 4 8 > > $group > [1] 1 1 > > $names > [1] "1" > > > > On Wed, Sep 9, 2009 at 3:25 PM, <guox at 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, >> >>> 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 return them by function? >> >> Thanks, >> >> -james >> >> ______________________________________________ >> 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. >> > > > > -- > Jim Holtman > Cincinnati, OH > +1 513 646 9390 > > What is the problem that you are trying to solve? > > >