x <- c(0.0002, 1.00003, 3.00014)
RoundWhole(x) # No values rounded
RoundWhole(x, 4) # One value rounded
RoundWhole(x, 3) # All values rounded
RoundWhole(x, NA) # No values rounded (always)
RoundWhole(x, 3, TRUE) # One value rounded
RoundWhole(cbind(x, x, x), digits = c(3, 4, NA))
RoundWhole(cbind(x, x), digits = 3, onlyZeros = c(FALSE, TRUE))
Run the code above in your browser using DataLab