search for: moddown

Displaying 1 result from an estimated 1 matches for "moddown".

Did you mean: moddowsn
2007 Aug 24
1
"rounding" to next lowest/highest 'x%%y' (mod) equals zero?
Dear smart ones, Image a vector 'test' that looks like so: 0 0.5 1.5 2.1 3.1 4 I'm looking for an efficient function that would do something like moddown <- function(test,integer){ for (element %in% test){ if (element%%integer != 0) { "return next lowest integer for which '%%' returns 0" } else { "return element" } } } and return for 'test' a vector like so: 0 0 0 2 2 4 My current...