Skip to content

Rounding to the nearest 5

3 messages · Steve Murray, Ottorino-Luca Pantani, Erich Neuwirth

#
Dear all,

A hopefully simple question: how do I round a series of values (held in an object) to the nearest 5? I've checked out trunc, round, floor and ceiling, but these appear to be more tailored towards rounding decimal places.

Thanks,

Steve



_________________________________________________________________

icons.
#
Steve Murray ha scritto:
I had a similar problem in the past
Take a look at
http://tolstoy.newcastle.edu.au/R/e4/help/08/05/11017.html
and to the replies
#
mround <- function(x,base){
	base*round(x/base)
}
[1] 15
Steve Murray wrote: