[R] Dotchart question

Peter Flom flom at ndri.org
Fri Sep 5 20:30:11 CEST 2003


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)




More information about the R-help mailing list