Dear R-helpers, In bwplot(pairL ~ asym, oppK) is a factor. It displays pairL in alphabetical order. How do I tell it to display, pairL in the order I wish , i.e., so the medians of asym are in ascending order? _____________________________ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 Parcels: Room 102 Gilmer Hall McCormick Road Charlottesville, VA 22903 Office: B011 +1-434-982-4729 Lab: B019 +1-434-982-4751 Fax: +1-434-982-4766 WWW: http://www.people.virginia.edu/~mk9y/
?factor (specifically, the levels= option) oppK<-oppK[order(median(oppK$asym),] oppK$pairL<-factor(oppK$pairL, levels=unique(oppK$pairL)) bwplot(pairL ~ asym, oppK) Mark Mark Herzog, Ph.D. Program Leader, San Francisco Bay Research Wetland Division, PRBO Conservation Science 4990 Shoreline Highway 1 Stinson Beach, CA 94970 (415) 893-7677 x308 mherzog at prbo.org Michael Kubovy wrote:> Dear R-helpers, > > In bwplot(pairL ~ asym, oppK) is a factor. It displays pairL in > alphabetical order. How do I tell it to display, pairL in the order I > wish , i.e., so the medians of asym are in ascending order? > > > _____________________________ > Professor Michael Kubovy > University of Virginia > Department of Psychology > USPS: P.O.Box 400400 Charlottesville, VA 22904-4400 > Parcels: Room 102 Gilmer Hall > McCormick Road Charlottesville, VA 22903 > Office: B011 +1-434-982-4729 > Lab: B019 +1-434-982-4751 > Fax: +1-434-982-4766 > WWW: http://www.people.virginia.edu/~mk9y/ > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > > >
On Wed, 4 Jan 2006, Michael Kubovy wrote:> In bwplot(pairL ~ asym, oppK) is a factor. It displays pairL in > alphabetical order. How do I tell it to display, pairL in the order I > wish , i.e., so the medians of asym are in ascending order?Actually, it displays pairL in the order of its levels. Trellis for S came with a function reorder.factor to re-order the levels, and base R has it too. There is a very similar example on ?reorder. More generally, see ?levels (There are other reorder.factor functions in Hmisc and gdata, which you may need to avoid.) -- Brian D. Ripley, ripley at stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UK Fax: +44 1865 272595
On 1/4/06, Michael Kubovy <kubovy at virginia.edu> wrote:> Dear R-helpers, > > In bwplot(pairL ~ asym, oppK) is a factor. It displays pairL in > alphabetical order. How do I tell it to display, pairL in the order I > wish , i.e., so the medians of asym are in ascending order?See ?reorder.factor, which has a very similar example you can adapt. In your case, you probably want something like: bwplot(reorder(factor(pairL), asym, median) ~ asym, oppK) The call to factor is unnecessary if pairL is already a factor. Deepayan -- http://www.stat.wisc.edu/~deepayan/