On Mon, Feb 25, 2008 at 6:03 AM, Peter Dalgaard
<[EMAIL PROTECTED]> wrote:
> Gabor Grothendieck wrote:
> > In looking at this again here is a slight simplification.  Its now
> > only one line:
> >
> >
> >> library(chron)
> >> x <- c("01/00/05", "01/22/06")
> >> as.chron(sub("/00/", "/15/", x)) + (regexpr("/00/", x) > 0) / 2
> >>
> > [1] (01/15/05 12:00:00) (01/22/06 00:00:00)
> >
> You don't really need chron here, do you?
>
> as.Date(sub("/00/", "/15/", x), format="%m/%d/%y")
>
> (The format spec seems to have been left out below. Also, beware the
> system-dependence of %y.)

Yes, you need chron since entire point was to encode the missings as
noon so one can reverse the procedure and Date does not support times.
Also the format was omitted because its not required.  m/d/y is the default
for chron.

______________________________________________
R-help@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.

Reply via email to