views:

121

answers:

0

Hi!

I want to put string labels on outliers in a boxplot.

Here's a simplification of the dataset I'm using:

[,x]    [,y]    [,z]
7       2       a
10      2       b
112     3       c  

boxdata<-boxplot(x ~ y)

To put values as label on outliers by group, I use this function:

for(i in 1:length(boxdata$group)){

text(boxdata$group[i], boxdata$out[i], which(x==boxdata$out[i]),labels=boxdata$out[i],pos=4)

}

The problem is that I want to put z (string) as label instead of outlier value, but I don't know how to proceed. What do I need to do?

Thank you!
Ben