Skip to content

interval division is failing mysteriously #235

Description

@retnuh

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions