[R] expanding 1:12 months to Jan:Dec

Gabor Grothendieck ggrothendieck at gmail.com
Thu Aug 20 14:02:41 CEST 2009


month.abb
month.name

On Thu, Aug 20, 2009 at 3:14 AM, Liviu Andronic<landronimirc at gmail.com> wrote:
> Dear R users
> I would like to do some spreadsheet style expansion of dates. For
> example, I would need to obtain a vector of months. I approached in an
> obviously wrong way:
>> paste(01:12)
>  [1] "1"  "2"  "3"  "4"  "5"  "6"  "7"  "8"  "9"  "10" "11" "12"
>> as.Date(paste(01:12), "%m")
>  [1] NA NA NA NA NA NA NA NA NA NA NA NA
>
> to subsequently format(.., "%b"). Other than writing the months
> manually, could anyone suggest an easier way to obtain such a list?
> Liviu
>
>
>
>
> --
> Do you know how to read?
> http://www.alienetworks.com/srtest.cfm
> Do you know how to write?
> http://garbl.home.comcast.net/~garbl/stylemanual/e.htm#e-mail
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list