Re: [R] Ceiling to the nearest ten?

From: Rob Robinson <rob.robinson_at_bto.org>
Date: Mon, 14 Jan 2008 17:25:49 -0000


Perhaps not the most elegant but 10*ceiling(x/10) usually works for me... Cheers
rob

Dr Rob Robinson, Senior Population Biologist British Trust for Ornithology, The Nunnery, Thetford, Norfolk, IP24 2PU

Ph: +44 (0)1842 750050         E: rob.robinson_at_bto.org
Fx: +44 (0)1842 750030         W: http://www.bto.org

> -----Original Message-----
> From: r-help-bounces_at_r-project.org
> [mailto:r-help-bounces_at_r-project.org] On Behalf Of Lauri Nikkinen
> Sent: 14 January 2008 17:18
> To: r-help_at_stat.math.ethz.ch
> Subject: [R] Ceiling to the nearest ten?
>
> R-users,
>
> Is there a function for ceiling to the nearest ten?
>
> a <- 1:10*4
> a
> [1] 4 8 12 16 20 24 28 32 36 40
>
> The resulting vector should look like this ("ceiling to the
> nearest ten") [1] 10 10 20 20 20 30 30 40 40 40
>

> Thanks in advance
> Lauri
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Mon 14 Jan 2008 - 17:33:52 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 14 Jan 2008 - 18:30:06 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive