s-news
[Top] [All Lists]

Re: Months as a character vector?

To: Karl Nissen <karl.nissen@anu.edu.au>
Subject: Re: Months as a character vector?
From: Prof Brian Ripley <ripley@stats.ox.ac.uk>
Date: Fri, 16 Nov 2001 09:00:41 +0000 (GMT)
Cc: <s-news@wubios.wustl.edu>
In-reply-to: <5.1.0.14.0.20011116162755.00ae3d70@127.0.0.1>
On Fri, 16 Nov 2001, Karl Nissen wrote:

> Hi,
>
> I'm trying to extract a character vector that has the name of the months.
> (S+ 6 on Windows 2000)
>
> The best I can do is this.
>
>  > factor.names(as.data.frame(months(0)))
> $X:
>   [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov"
> [12] "Dec"
>
> Is there a neater, less roundabout way of doing this?

I would use

> month.abb
 [1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct" "Nov" "Dec"

Even levels(months(0)) would be easier.


I might point out that what I consider to be the names are given by
`month.name' (not abbreviated), and also that S-PLUS is US-centric and
AFAIK ignores the locale, so that I know of no way in S-PLUS to get the
names in, say, Dutch.   (Although the Dutch market may be small, the
total market for say ISOLatin1/2/9 languages is not.)

-- 
Brian D. Ripley,                  ripley@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 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595


<Prev in Thread] Current Thread [Next in Thread>