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

Liviu Andronic landronimirc at gmail.com
Thu Aug 20 09:14:33 CEST 2009


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




More information about the R-help mailing list