Hello,
I'm a bit puzzled by what looks (to me) like a discrepancy between
documentation and implementation.
The documentation for [] says this about the indices: "Numeric values are
coerced to integer as by as.integer (and hence truncated towards zero)."
> as.integer(-3.1)
[1] -3
Good. But:
Hello, That is my first post here and I'd like to thanks everybody in
advance.
I am writing a package with some R functions and try to submit it to CRAN.
After build and check the package a number of times, I am struggling with
the fact that the CRAN people responsible for checking packages are
r
I can reproduce this. It seems to be happen when trying to drop the
last element, e.g.
> x <- 1:3
> x[-3.1]
[1] 1 2 3
> x[-2.1]
[1] 1 3
> x[-1.1]
[1] 2 3
> x <- 1:2
> x[-2.1]
[1] 1 2
> x[-1.1]
[1] 2
> x <- 1:4
> x[-4.1]
[1] 1 2 3
> x[-3.1]
[1] 1 2 4
> x[-2.1]
[1] 1 3 4
> x[-1.1]
[1] 2 3 4
> x
On 04/09/2014 12:52 PM, Henrik Bengtsson wrote:
I can reproduce this. It seems to be happen when trying to drop the
last element, e.g.
> x <- 1:3
> x[-3.1]
[1] 1 2 3
> x[-2.1]
[1] 1 3
> x[-1.1]
[1] 2 3
> x <- 1:2
> x[-2.1]
[1] 1 2
> x[-1.1]
[1] 2
> x <- 1:4
> x[-4.1]
[1] 1 2 3
> x[-3.1]
[1] 1
Just for the sake of completeness, I raised a closely related issue back in
2010 which my students discovered.
https://stat.ethz.ch/pipermail/r-help/2010-March/231788.html
Bryan
On Sep 4, 2014, at 11:17 AM, Michael Haupt wrote:
> Hello,
>
> I'm a bit puzzled by what looks (to me) like a disc