Martin Maechler wrote: >>>>>> "OL" == Ola Lindqvist <[EMAIL PROTECTED]> >>>>>> on Tue, 21 Aug 2007 14:32:19 +0200 writes: >>>>>> > > OL> Thanks! > OL> Seems to work fine now! > > Well, for your example. > > But sorry to say, the patch breaks other cases. > > I'm investigating further > (and will hopefully contribute to a new CRAN release of fCalendar > once Diethelm Wuertz is back from wherever; I've already made > more changes) > >
Good to see experts investigating :-) Sorry, I should have mentioned, at least, that I am not an Rmetrics developer, that I only took a quick glance at the code (focused on the reported problem), and that the patched version is neither official nor tested. Now I see that I completely messed up the case for "Date" input and sometimes .midnightStandard() was not working correct any more. One further issue, which was brought to my attention by another R-user off list: I think, that all occurences of if (sum(lt$sec+lt$min+lt$hour) == 0) isoFormat = "%Y-%m-%d" in R/3A-TimeDateClass.R could safely be replaced by if (sum(lt$sec+lt$min+lt$hour,na.rm=TRUE) == 0) isoFormat = "%Y-%m-%d" in order to make fCalendar more NA-friendly. Currently, at least for some cases, a single NA entry in the input vector suffices to let timeDate() break down. Again, I am not sure, if this change breaks some special cases, or if breaking down in case of NAs is intended. Nevertheless, I have built a new, unofficial and untested patched (windows-)version of fCalendar (same weblink), which makes the "Date" input case and .midnightStandard() working again (I hope so, at least), and incorporates the (improved?) NA-handling. But of course: only use this version with care (and only if the official version doesn't work for your particular problem). Hopefully, we see an official update on CRAN soon :-) Kind regards, Martin Becker > Martin Maechler, > ETH Zurich [but different department than D.Wuertz] > > > OL> Martin Becker wrote: > >> 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@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. > >>> > >> > > OL> ______________________________________________ > OL> R-help@stat.math.ethz.ch mailing list > OL> https://stat.ethz.ch/mailman/listinfo/r-help > OL> PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > OL> and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ R-help@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.