On 5 Sep 2003 at 14:30, Peter Flom wrote: prof <- c('Accountant', 'Administrative assistant', 'Garment worker', 'Cook', 'Dentist', 'General practictioner', 'Graduate student', 'High level manager', 'Low level manager', 'Mechanical engineer', 'Mechanic', 'Minister/priest/rabbi', 'Nurse', 'Professor', 'Sales clerk', 'Server', 'Taxi driver')
mol <- c(34, 29, 27, 36, 20, 40, 35, 32, 30, 31, 30, 32, 37, 37, 27, 28, 36) o <- order(mol) mol <- mol[o] prof <- prof[o] dotchart(mol, labels = prof, main = 'Dot chart', xlab = 'Meaning of life score') Works for me. Kjetil Halvorsen > Sorry to keep asking elementary questions......I appreciate the help. > > I am trying to create a dotchart with the rows sorted according to the > values, rather than the labels. When I try > > prof <- c('Accountant', 'Administrative assistant', 'Garment worker', > 'Cook', > 'Dentist', 'General practictioner', 'Graduate student', 'High level > manager', > 'Low level manager', 'Mechanical engineer', 'Mechanic', > 'Minister/priest/rabbi', > 'Nurse', 'Professor', 'Sales clerk', 'Server', 'Taxi driver') > mol <- c(34, 29, 27, 36, 20, 40, 35, 32, 30, 31, 30, 32, 37, 37, 27, > 28, 36) > > dotchart(mol, labels = prof, main = 'Dot chart', xlab = 'Meaning of > life score') > > I get a dot chart sorted by the values of prof; what I'd like is one > sorted by values of mol. > > I looked at the help file for dotchart, but did not see anything. > > Thanks again in advance > > Peter L. Flom, PhD > Assistant Director, Statistics and Data Analysis Core > Center for Drug Use and HIV Research > National Development and Research Institutes > 71 W. 23rd St > www.peterflom.com > New York, NY 10010 > (212) 845-4485 (voice) > (917) 438-0894 (fax) > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help