Re: [R] Replace number with month

From: Peter Dalgaard <>
Date: Thu, 21 Jun 2007 10:15:30 +0200

Don MacQueen wrote:
> You can get the names using
> And it may be necessary to use
> factor([MM],[1:12])
> to get them to show up in the correct order in the barchart.

You're crossing the creek to fetch water there, and getting yourself soaked in the process... (by an unnecessary conversion to character which is subject to alphabetical sorting)

I think the canonical way is

factor(MM, levels=1:12,

(and the levels=1:12 may not even be necessary when all 12 months are present)

   O__  ---- Peter Dalgaard             Ă˜ster Farimagsgade 5, Entr.B
  c/ /'_ --- Dept. of Biostatistics     PO Box 2099, 1014 Cph. K
 (*) \(*) -- University of Copenhagen   Denmark          Ph:  (+45) 35327918
~~~~~~~~~~ - (                  FAX: (+45) 35327907

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Thu 21 Jun 2007 - 08:21:38 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 21 Jun 2007 - 08:32:32 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.