[R] cut ()
Neal H. Walfield
neal at walfield.org
Tue Jan 1 10:42:33 CET 2013
At Tue, 1 Jan 2013 02:00:14 +0000,
Muhuri, Pradip (SAMHSA/CBHSQ) wrote:
> Although David's solution (putting the right parenthesis, which I had missed) has resolved the issue, I would like to try yours as well.
> Could you please clarify the six elements: c(-1e-8, 0, 0, 0, 0, 1e8)?
It's a vector. Floating point numbers can't always store an exact
representation. So, for instance, R evaluates ".1 == .3 / 3" as
FALSE. If instead you had done: "abs(.1 - .3 / 3) < 1e-8", the result
would be true. The latter does not check for strict equality, but
whether the value is within some small delta of the target. Read
chapter 1 of the R Inferno.
Note, the last element of the vector should be 1e-8, not 1e8.
More information about the R-help