[Rd] as.Date nuance

Prof Brian Ripley ripley at stats.ox.ac.uk
Sat Mar 24 11:21:41 CET 2007


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



More information about the R-devel mailing list