Ajay Shah <ajayshah <at> mayin.org> writes:

> 
> How do I parse a date "yyyymmdd"? I tried asking chron(s, "ymd") but
> that didn't work. Would the date parsing routines of the Date class of
> 1.9 grok this?
> 


Others have already mentioned z <- as.Date("20040527",format="%Y%m%d")
and if you want it as a chron date try:

chron(unclass(z))

The percent codes in Date are convenient so that's probably the way
to go but just for fun, to do it in chron without using the Date class
you could convert it to the form 05/27/2004 using sub and then apply 
chron:

chron(sub("(....)(..)(..)","\\2/\\3/\\1","20040527"))

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Reply via email to