[R] R timeDate does not allow seconds?

B. Bogart bbogart at sfu.ca
Fri Nov 2 22:51:19 CET 2007


Hi Jim,

Yes that works!!!

Why the heck do I need to put "%H.%M.%S" when the input format is 
"%H:%M:%S" ? ("." in place of ":".

I see in the help(timeDate) examples where the format is properly 
written as "%Y-%m-%d %H:%M:%S"

So why does this not work:

 > date = timeDate(as.character(inputdate),format="%Y-%m-%d_%H:%M:%S")
Error in if (regexpr("/....", charvec[1])[[1]] > 0) return("%m/%d/%Y") :
        missing value where TRUE/FALSE needed

Thanks so much, I don't see how I could have known I would have to put 
"." in place of ":" in the format string.

B. Bogart
Simon Fraser University

jim holtman wrote:
> Seems to work fine with this call:
>
>   
>> inputdate = "2007-10-31_16.20.22"
>> timeDate(as.character(inputdate),format="%Y-%m-%d_%H.%M.%S")
>>     
> GMT
> [1] [2007-10-31 16:20:22]
>   
>
>



More information about the R-help mailing list