Hi
r-help-boun...@r-project.org napsal dne 09.06.2010 13:16:40:
Dear R community,
I am puzzled by the following lines:
v - seq(-0.5,0.5,by=0.1)
v
[1] -0.5 -0.4 -0.3 -0.2 -0.1 0.0 0.1 0.2 0.3 0.4 0.5
which(v == -0.4)
[1] 2
which(v == 0)
[1] 6
which(v == 0.1)
which(abs(v - .1) = .Machine$double.eps)
seems to me too cumbersome to write. Any other easier way? all.equal
does not quite work
Nikhil
On Jun 9, 2010, at 7:54 AM, Petr PIKAL wrote:
Hi
r-help-boun...@r-project.org napsal dne 09.06.2010 13:16:40:
Dear R community,
I am puzzled by the
Hi
Well, then please explain what you really want to do. I use such
fractional sequences only for evaluation of some models and in that case
this finite precision issue is not important.
Regards
Petr
r-help-boun...@r-project.org napsal dne 09.06.2010 14:20:16:
which(abs(v - .1) =
use ?round is the easier way
v - round(seq(-0.5,0.5,by=0.1),1)
On Wed, Jun 9, 2010 at 2:20 PM, Nikhil Kaza nikhil.l...@gmail.com wrote:
which(abs(v - .1) = .Machine$double.eps)
seems to me too cumbersome to write. Any other easier way? all.equal does
not quite work
Nikhil
On Jun 9, 2010,
On Wed, Jun 9, 2010 at 2:20 PM, Nikhil Kaza nikhil.l...@gmail.com wrote:
which(abs(v - .1) = .Machine$double.eps)
seems to me too cumbersome to write. Any other easier way? all.equal does
not quite work
See isZero() in R.utils, e.g.
isZero(abs(v - 0.1));
You can adjust the precision with
5 matches
Mail list logo