[R] round 2.3 to 2.5 and 2.2 to 2.0

Uwe Ligges ligges at statistik.tu-dortmund.de
Mon Jan 7 11:21:39 CET 2013



On 07.01.2013 09:59, Mat wrote:
> Hello together,
>
> i want to round some numbers in my data.frame.
> How can i round a number to values like 0.5; 1.0; 1.5; 2.0; etc.
>
> It should look like this one
>
> before
> 2.2 ; 2.3; 2.26; 1.11
>
> after
> 2.0; 2.5; 2.5; 1.0


round(2*x)/2

Uwe Ligges

> thanks.
>
> Mat
>
>
>
> --
> View this message in context: http://r.789695.n4.nabble.com/round-2-3-to-2-5-and-2-2-to-2-0-tp4654813.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list