[R] library(fCalendar) timeDate("12.03.2005", format="%d.%m.%Y")

Martin Becker martin.becker at mx.uni-saarland.de
Mon Aug 20 16:40:04 CEST 2007


Dear Ola,

I think you spotted a small bug in *package* fCalendar.
Explicit specification should prevent "autodetection" of the date 
format, which is not the case for fCalendar v251.70, instead 
autodetection is done at least once (twice, if actually appropriate).
With the following patch, things should work ok:

diff --recursive fCalendar.orig/R/3A-TimeDateClass.R 
fCalendar/R/3A-TimeDateClass.R
433c433
<     charvec = format(strptime(charvec, .whichFormat(charvec)), isoFormat)
---
 >     charvec = format(strptime(charvec, format), isoFormat)

You did not provide the output of sessionInfo() (which you are asked for 
in the posting guide). If you are using Windows and don't know how to 
apply the patch, you can download a patched binary version here:
   
   http://www.saar-gate.net/download/fCalendar_251.70.zip

Regards,

   Martin

PS: Maybe r-sig-finance is more appropriate for questions concerning 
Rmetrics.


Ola Lindqvist wrote:
> Dear R users,
> I have problem with the library fCalendar.
>
> I am not using the US standard format notations. It seems like it is not 
> possible to have different format than the US standards.
> Anyone how knows a way to go around this problem?
>
> Here is the code I enter:
> myDate = "12.03.2005"
> timeDate(myDate, format = "%d.%m.%Y")
>
> And I get following error message:
> Error in if (sum(lt$sec + lt$min + lt$hour) == 0) isoFormat = "%Y-%m-%d" :
>         missing value where TRUE/FALSE needed
>
> Thanks,
> Ola
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



More information about the R-help mailing list