[R] Dotchart question

Tito de Morais Luis Luis.Tito-de-Morais at ird.sn
Fri Sep 5 21:30:05 CEST 2003


This one is ugly, but works...

molprof<-data.frame(mol,prof)
molprof <- molprof[with(molprof,order(mol)), ]
dotchart(molprof$mol, labels = as.character(molprof$prof), main = 'Dot
chart', xlab = 'Meaning of life score')

HTH

Tito


Le ven 05/09/2003 à 18:30, Peter Flom a écrit :
> 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)
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
-- 
L. Tito de Morais
      UR RAP
   IRD de Dakar
      BP 1386
       Dakar
      Sénégal

Tél.: + 221 849 33 31
Fax: +221 832 16 75
Courriel: tito at ird.sn




More information about the R-help mailing list