Re: [R] Displaying median value over the horizontal(median)line in the boxplot

2013-03-21 Thread arun
Hi, Just a modified version with colnames as titles set.seed(45) test1<-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10))  par(mfrow=c(1,2))  lapply(seq_len(ncol(test1)),function(i) {b<- boxplot(test1[,i],range=0,horizontal=TRUE,main=colnames(test1[i]),  boxwex=0.5); mtext(sprintf("%.1f",b$s

Re: [R] Displaying median value over the horizontal(median)line in the boxplot

2013-03-21 Thread arun
Hi, set.seed(45) test1<-data.frame(columnA=rnorm(7,45),columnB=rnorm(7,10)) #used an example probably similar to your actual data apply(test1,2,function(x) sprintf("%.1f",median(x))) #columnA columnB # "44.5"  "10.2" par(mfrow=c(1,2)) lapply(test1,function(x) {b<- boxplot(x,range=0,horizontal=T