Thanks.
It really seemed to be a bug.

Rui Barradas

Em 20-10-2016 11:33, Peter Dalgaard escreveu:
It's a bug (left.open=FALSE code gets executed in some cases). Hoping to have a 
fix tested and in place before 3.3.2.

-pd

On 17 Oct 2016, at 21:48 , Rui Barradas <ruipbarra...@sapo.pt> wrote:

Hello,

Same on Windows 7.

findInterval(x=c(6, 1, 1, 1), vec=c(0, 1, 3, 5, 10), left.open=TRUE)
[1] 4 2 1 1
findInterval(x=c(4, 1, 1, 1), vec=c(0, 1, 3, 5, 10), left.open=TRUE)
[1] 3 1 1 1
sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

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

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

other attached packages:
[1] lattice_0.20-33

loaded via a namespace (and not attached):
[1] tools_3.3.1 grid_3.3.1

Rui Barradas

Em 17-10-2016 20:03, Dmitriy Chernykh via R-help escreveu:
Hello,

I call function findInterval in the following way:

findInterval(x=c(6, 1, 1, 1), vec=c(0, 1, 3, 5, 10), left.open=TRUE),

and expect that it will return 4 1 1 1. But the function returns 4 2 1 1 
instead. Moreover, if I change the first element in x to, say, 4 -

findInterval(x=c(4, 1, 1, 1), vec=c(0, 1, 3, 5, 10), left.open=TRUE)

then the function returns 3 1 1 1.

Why are results for identical elements in x not the same? And why is element in 
x influenced by previous one? I suspect this is a bug but I am not 100% sure.

Technical details:

sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 14.04.5 LTS

locale:
  [1] LC_CTYPE=ru_RU.UTF-8       LC_NUMERIC=C               LC_TIME=ru_RU.UTF-8 
       LC_COLLATE=ru_RU.UTF-8     LC_MONETARY=ru_RU.UTF-8
  [6] LC_MESSAGES=ru_RU.UTF-8    LC_PAPER=ru_RU.UTF-8       LC_NAME=C           
       LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=ru_RU.UTF-8 LC_IDENTIFICATION=C

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

loaded via a namespace (and not attached):
[1] tools_3.3.1


Thanks.


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

Reply via email to