Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

interval division is failing mysteriously #235

Closed
retnuh opened this issue Apr 26, 2014 · 1 comment
Closed

interval division is failing mysteriously #235

retnuh opened this issue Apr 26, 2014 · 1 comment
Labels
bug an unexpected problem or unintended behavior

Comments

@retnuh
Copy link

retnuh commented Apr 26, 2014

a=interval(ymd(20140331), ymd(20140419))
a
[1] 2014-03-31 UTC--2014-04-19 UTC
a %/% months(1)
Error in while (any(start + est * per < end)) est[start + est * per < :
missing value where TRUE/FALSE needed

However, when using a period, it seems ok:

as.period(a) %/% months(1)
[1] 0

I think it has something to do with being near the end of the month:

b=interval(ymd(20140330), ymd(20140419))
b %/% months(1)
[1] 0

for (d in c(20140131, 20140130, 20140129, 20140128)) tryCatch({ a=interval(ymd(d), ymd(20140219)); print(a); print(a %/% months(1))}, error=function(e){print(e)})
[1] 2014-01-31 UTC--2014-02-19 UTC
<simpleError in print(a%/%months(1)): error in evaluating the argument 'x' in selecting a method for function 'print': Error in while (any(start + est * per < end)) est[start + est * per < :
missing value where TRUE/FALSE needed

[1] 2014-01-30 UTC--2014-02-19 UTC
<simpleError in print(a%/%months(1)): error in evaluating the argument 'x' in selecting a method for function 'print': Error in while (any(start + est * per < end)) est[start + est * per < :
missing value where TRUE/FALSE needed

[1] 2014-01-29 UTC--2014-02-19 UTC
<simpleError in print(a%/%months(1)): error in evaluating the argument 'x' in selecting a method for function 'print': Error in while (any(start + est * per < end)) est[start + est * per < :
missing value where TRUE/FALSE needed

[1] 2014-01-28 UTC--2014-02-19 UTC
[1] 0

Let me know if there is anything else you need.

Cheers,

H

sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_Ireland.1252 LC_CTYPE=English_Ireland.1252
[3] LC_MONETARY=English_Ireland.1252 LC_NUMERIC=C
[5] LC_TIME=English_Ireland.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] sqldf_0.4-7.1 RSQLite.extfuns_0.0.1 gsubfn_0.6-5
[4] proto_0.3-10 lubridate_1.3.3 data.table_1.9.2
[7] stringr_0.6.2 RSQLite_0.11.4 DBI_0.2-7
[10] Matrix_1.1-3

loaded via a namespace (and not attached):
[1] chron_2.3-45 digest_0.6.3 grid_3.0.2 IBrokers_0.9-10 lattice_0.20-23
[6] memoise_0.1 plyr_1.8 RCurl_1.95-4.1 reshape2_1.2.2 tcltk_3.0.2
[11] tools_3.0.2

@vspinu
Copy link
Member

vspinu commented Dec 13, 2014

This is also a cause of #284. It has to do with the internal use of + on periods. I have though half a day today how to fix it, but haven't found an elegant solution as yet. Added a note to the code. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants