On 21 Aug 2014, at 02:21 , Gabriel Becker <gmbec...@ucdavis.edu> wrote:

> Ah, my mistake, I read too fast. (My code is also wrong, embarassingly).
> 
> It seems like it's behavior when you pass it "" is simply a bug, then.
> 
> Sorry for the noise,
> 
> ~G
> 

It's not a bug, it's just that you are at the mercy of strptime() if you do 
specify a format. If the format doesn't contain a conversion for some 
component, you get the value corresponding to the current date and leftover 
characters are just ignored, e.g.

> strptime("1-1foo","%m-%d")
[1] "2014-01-01"

and the extreme case is that a "" format gives current date, whatever the 
input. On Mac OSX Mavericks anyway --- this stuff is system-dependent.

So I think Peter Langfelder is absolutely right, remove the default, which is 
never used anyway, and possibly update the documentation with a more direct 
reference to strptime(). This should have near-zero effect on the semantics. 

Peter D.

> 
> 
> 
> On Wed, Aug 20, 2014 at 4:59 PM, Peter Langfelder <
> peter.langfel...@gmail.com> wrote:
> 
>> On Wed, Aug 20, 2014 at 4:52 PM, Gabriel Becker <gmbec...@ucdavis.edu>
>> wrote:
>>> Could do both to preserve bc...
>>> 
>>> if(missing(format) || !nchar(format))
>>> 
>> 
>> No, the problem is that the function behaves differently when format
>> is missing than when it equals its default. Removing this difference
>> necessarily changes behaviour and hence (at least in principle) breaks
>> backward compatibility.
>> 
>> Peter
>> 
> 
> 
> 
> -- 
> Gabriel Becker
> Graduate Student
> Statistics Department
> University of California, Davis
> 
>       [[alternative HTML version deleted]]
> 
> ______________________________________________
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd....@cbs.dk  Priv: pda...@gmail.com

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to