[R] Re : labels outliers in boxplot

From: justin bem <justin_bem_at_yahoo.fr>
Date: Wed 17 Jan 2007 - 07:13:02 GMT


I use to do this (It may help you)
>boxplot(x)
>bx<-boxplot(x,plot=F)

In bx object, you and object names out with yaxis cordinates. For the i-th boxplot in the figure, use
>text(rep(i,length(bx$out)),bx$out,...)
 

Justin BEM
Elève Ingénieur Statisticien Economiste
BP 294 Yaoundé.
Tél (00237)9597295.

Some information on the outliers is returned from the boxplot function. Try something like:

set.seed(123)
tmp <- data.frame( group=gl(3,10),
  y=rcauchy(30), sex=gl(2,5,30,c('M','F')) )

tmp2 <- boxplot( split(tmp$y,tmp$group) ) identify( tmp2$group, tmp2$out, tmp2$group )

Or if your grouping variable works out to the same values as the x axis (used integers) and you want to specify a 3rd variable to be the labels you can do:

Identify( tmp$group, tmp$y, tmp$sex )

Hope this helps,

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow@intermountainmail.org
(801) 408-8111
 
 


> -----Original Message-----
> From: r-help-bounces@stat.math.ethz.ch
> [mailto:r-help-bounces@stat.math.ethz.ch] On Behalf Of
> antoniababe@yahoo.se
> Sent: Wednesday, January 10, 2007 2:08 PM
> To: r-help@stat.math.ethz.ch
> Subject: [R] labels outliers in boxplot
>
> Dear R-users,
>
> Following is part of my data, where slide has 36 levels and
> block 48 levels. I have done boxplot for each slide on the
> same graph. There are outliers for each slide and I tried to
> use indentify functtion to identify outliers in such a way
> that when I click on an outlier or point, the points will be
> labelled by either their block or ID or by both but without
> success. How can I make it work or are there other ways to do
> it than using identify function?
>
>
> Thanks in advance,
>
> Jenny,
>
> dat1[1:10,]
> y Slide Block ID Control
> 1 0.03147823 1 1 IgG-human 5
> 2 -0.23815974 1 1 LPPAANDVSVLTAAR 0
> 3 -0.71926359 1 1 HTKHYRVVSKPAALV 0
> 4 -0.14607826 1 1 FVALPAATADAYATT 0
> 5 0.89553073 1 1 NYPAMMAHAGDMAGY 0
> 6 -0.67587100 1 1 RRALRQIGVLERPVG 0
> 7 0.32636034 1 1 DCGTIRVGSFRGRWL 0
> 8 -1.44057259 1 1 MAKLSTDELLDAFKE 0
> 9 -0.37064338 1 1 LELSDFVKKFEETFE 0
> 10 -0.20387233 1 1 VSRRAKVDVLIVHTT 0
>
>
> tb_ncs<-subset(dat1,dat1$Control==1) ### this
> data contains only negative controls
>
> par(las=2,mar=c(10.1,4.1,4.1,2.1))
>
> boxplot(split(tb_ncs$y,tb_ncs$Slide),col="orange",
> cex=.65,
> outline=TRUE,main="Negative control
> response of each patient", cex.main=1, font.main=1,
> col.main="blue",
> names=c(1:35,"B"))
> grid(nx=NA, ny=NULL)
> ### grid over boxplot
> legend("bottomright", "B = Buffer +
> sec",text.col="blue")
>
>
> out.block<-
> identify(tb_ncs$y,tb_ncs$Slide)
>
>
>
>
>
>
> _________________________________________________________
> Flyger tiden iväg? Fånga dagen med Yahoo! Mails inbyggda
>
> ______________________________________________
> R-help@stat.math.ethz.ch 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.
>
______________________________________________ R-help@stat.math.ethz.ch 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. ___________________________________________________________________________ Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! Profitez des connaissances, des opinions et des expériences des internaut [[alternative HTML version deleted]]

______________________________________________ R-help@stat.math.ethz.ch 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.

Received on Wed Jan 17 18:18:32 2007

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Wed 17 Jan 2007 - 09:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.