From vdergachev at rcgardis.com  Sat Mar 24 16:51:13 2007
From: vdergachev at rcgardis.com (Vladimir Dergachev)
Date: Sat, 24 Mar 2007 11:51:13 -0400
Subject: [Rd] as.Date nuance
In-Reply-To: <Pine.LNX.4.64.0703241017450.32697@gannet.stats.ox.ac.uk>
References: <200703231930.03846.vdergachev@rcgardis.com>
	<Pine.LNX.4.64.0703241017450.32697@gannet.stats.ox.ac.uk>
Message-ID: <200703241151.13734.vdergachev@rcgardis.com>

On Saturday 24 March 2007 6:21 am, Prof Brian Ripley wrote:
> This is how strptime() works: it processes the input to match the format.

Except that the format does not match the string - there are leftover 
characters. Even by R's own definition:

> match("a", "ab")
[1] NA

as, of course, is reasonable.

Is there some way to make sure there is an exact match ?

                        thank you !

                                   Vladimir Dergachev

>
> On Fri, 23 Mar 2007, Vladimir Dergachev wrote:
> >  I have encountered a nuance in as.Date() behaviour that is not
> > altogether
> >
> > obvious - not sure whether this is intended or not:
> >> as.Date("2001-01-01error")
> >
> > [1] "2001-01-01"
> >
> > I.e. it ignores the rest of the characters. This happens both in 2.3.1
> > and 2.4.1 versions.
>
> It has always occurred.
>
> > This also happens with explicit format specification:
> >> as.Date("2006-01-01error", format="%Y-%m-%d")
> >
> > [1] "2006-01-01"
> >
> >                    thank you
> >
> >                        Vladimir Dergachev



[Rd] as.Date nuance
Vladimir Dergachev