From ripley at stats.ox.ac.uk  Sat Mar 24 11:21:41 2007
From: ripley at stats.ox.ac.uk (Prof Brian Ripley)
Date: Sat, 24 Mar 2007 10:21:41 +0000 (GMT)
Subject: [Rd] as.Date nuance
In-Reply-To: <200703231930.03846.vdergachev@rcgardis.com>
References: <200703231930.03846.vdergachev@rcgardis.com>
Message-ID: <Pine.LNX.4.64.0703241017450.32697@gannet.stats.ox.ac.uk>

This is how strptime() works: it processes the input to match the format.

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

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595



[Rd] as.Date nuance
Prof Brian Ripley