For numbers ending in 5 Excel always rounds up and I want to reproduce this in R
rather than use the round function.
I have tried:
x<-as.integer(x*100+0.5)/100
and
x<-floor(x*100+0.5)/100
However, some values of x cause problems e.g
x<-floor(4.145*100+0.5)/100
4.14
I have tried breaking it down into steps and force the results to 10 significant
figures in the following function, which seems to work
roundoff<-function(x){
a<-signif(x*100+0.5,digits=10)
roundoff<-floor(a)/100
roundoff
}
Is there a more sensible way of do this for all numbers?
Thanks
Mike
[[alternate HTML version deleted]]
______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help