Thanks, that works great. Andrew On Fri, May 22, 2009 at 5:42 PM, William Dunlap <wdun...@tibco.com> wrote:
> > -----Original Message----- > > From: r-help-boun...@r-project.org > > [mailto:r-help-boun...@r-project.org] On Behalf Of Andrew Yee > > Sent: Friday, May 22, 2009 2:16 PM > > To: r-h...@stat.math.ethz.ch > > Subject: [R] stripchart and ordering of plot > > > > Take for example the following stripchart that's created: > > > > b <- 1:5 > > a <- 11:15 > > e <- 21:25 > > f <- -11:-15 > > > > foo <- rbind(b,a,e,f) > > > > stripchart(foo ~ rownames(foo)) > > > > In this case, I would like the bottom part of the plot to be > > the f vector, > > followed by the e vector, etc. > > > > However, R reorders the matrix and plots according to the > > alphabetical order > > of the rownames of foo. Is there a way to plot the matrix in > > the current > > order of the rownames? > > If you supply a factor it will use the order of the factor > levels. If you supply a character vector, it converts it > into a factor and the converter puts the levels in alphabetical > order by default. Hence one solution is to change that > character vector into a factor with the desired order > of levels: > stripchart(foo ~ factor(rownames(foo), levels=c("f","e","a","b")) > > Bill Dunlap > TIBCO Software Inc - Spotfire Division > wdunlap tibco.com > > > > > Thanks, > > Andrew > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@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. > > > [[alternative HTML version deleted]] ______________________________________________ R-help@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.