Re: [R] ordering a boxplot

2015-03-22 Thread Antonio Silva
Dear Boris, Thanks very much, have a great week. Best regards Antônio Olinto Fisheries Institute São Paulo, Brasil 2015-03-21 21:09 GMT-03:00 Boris Steipe : > ... just for completeness - the more concise way: (no need to go through > names()). > > boxplot(mydata[,order(apply(mydata,2,median)

Re: [R] ordering a boxplot

2015-03-21 Thread Boris Steipe
... just for completeness - the more concise way: (no need to go through names()). boxplot(mydata[,order(apply(mydata,2,median))]) ... or descending boxplot(mydata[,order(-apply(mydata,2,median))]) B. On Mar 21, 2015, at 7:04 PM, Boris Steipe wrote: > There may be more concise ways to d

Re: [R] ordering a boxplot

2015-03-21 Thread Boris Steipe
There may be more concise ways to do this - but you are 99% there with your approach: try: boxplot(mydata[,names(sort(apply(mydata,2,median)))]) B. On Mar 21, 2015, at 6:49 PM, Antonio Silva wrote: > Thanks Bill and David > > Here goes an example > > SP1<-c(9,6,7,8,5,8,7,5,9,7) > SP2<-c(1,

Re: [R] ordering a boxplot

2015-03-21 Thread Antonio Silva
Thanks Bill and David Here goes an example SP1<-c(9,6,7,8,5,8,7,5,9,7) SP2<-c(1,3,4,2,4,2,5,3,2,1) SP3<-c(4,6,7,5,7,8,7,6,5,4) SP4<-c(5,4,3,5,2,3,4,3,4,2) mydata<-data.frame(SP1,SP2,SP3,SP4) rownames(mydata)<-c("ST1","ST2","ST3","ST4","ST5","ST6","ST7","ST8","ST9","ST10") mydata boxplot(mydata)

Re: [R] ordering a boxplot

2015-03-21 Thread William Dunlap
You can use the reorder() function to reorder the grouping vector's factor levels according to a function of the data in each group. E.g., compare the following two plots: d <- data.frame(Response=cos(1:15), Group=rep(c("A","B","C"),c(6,5,4))) par(mfrow=c(1,2)) boxplot(Response ~ Group,

Re: [R] ordering a boxplot

2015-03-21 Thread David Winsemius
On Mar 20, 2015, at 2:20 PM, Antonio Silva wrote: > Hello > > I'm using a dataframe (mydata) where row names are sampling points and > column names are species in a multivariate analysis. > > If I write boxplot(mydata) I'll have boxplots for each species abundance in > alphabetical order. > >