[R] boxplot and number of observations per box

S Ellison S.Ellison at lgc.co.uk
Wed Jan 30 13:30:12 CET 2008


Do you mean something like

y<-rnorm(50)
x<-factor(sample(letters[1:5],50,replace=T))
boxplot(y~x)
text(1:5,rep(min(y),5),paste("n=",tapply(y,x,length)) )
?
(You can fiddle about with the text placement easily enough).

Also note that boxplot's varwidth parameter provides a graphical
indication of group size;
boxplot(y~x, varwidth=T)


 

>>> Marc Bernard <bernarduse1 at yahoo.fr> 30/01/2008 11:43:15 >>>
Dear all,
   
  How can I plot the number of observations per box in a boxplot. Many
thanks,
   
  Bernard
   
   

       
---------------------------------

	[[alternative HTML version deleted]]

______________________________________________
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.

*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}



More information about the R-help mailing list