[R] "rounding" to next lowest/highest 'x%%y' (mod) equals zero?

Johannes Graumann johannes_graumann at web.de
Fri Aug 24 17:17:59 CEST 2007


Richard M. Heiberger wrote:

>> tmp <- c(0,.5,1.5,2.1,3.1,4)
>> floor(tmp/2)
> [1] 0 0 0 1 1 2
>> floor(tmp/2)*2
> [1] 0 0 0 2 2 4

Thanks so much!

Joh



More information about the R-help mailing list