A very straightforward way to avoid this problem is to construct the
sequence by multiplying a sequence of integers by an approriate
constant. E.g. for your first example:
for( i in where ){
thisdata<- subset(herde, herde$mlr>= i)
# do stuff with thisdata..
}
'where' is a vector like 0.1*((-10):10)
[ instead of seq(-1, 1, by=0.1) ]
and then, when you want to change to seq(-0.8, 1, by=0.1),
use instead 0.1*(-80,10).
Hi,
this helps, thank you.
But if this code is in a function, and some user supplies a vector, I
will still have to round it in the function, I guess.
It's weird how 0.1 is different from round(0.1, digits=1) , but I don't
want to read that 90 page long floating point paper which was referenced
somewhere :)
Thanks,
Alex
______________________________________________
R-help@r-project.org mailing list
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.