[Rd] round(4.5) does not work (PR#9439)

Duncan Murdoch murdoch at stats.uwo.ca
Sun Jan 7 18:39:53 CET 2007


On 1/6/2007 10:01 PM, cstevenson at edisonresearch.com wrote:
> Anything that has 4.5 in it will always round to 4.  For example 24.5 becomes 24 and 34.5 becomes 34.  Or 1234567894.5 will become 1234567894.
> 
>> round(4.5)
> [1] 4
>> round(3.5)
> [1] 4

That's behaving as documented, using "banker's rounding". See the ?round 
man page.

Duncan Murdoch

> Thanks,
> 
> Clint W. Stevenson
> Senior Statistician
> Edison Media Research
> cstevenson at edisonresearch.com
> 
> 
> --please do not edit the information below--
> 
> Version:
>  platform = i386-pc-mingw32
>  arch = i386
>  os = mingw32
>  system = i386, mingw32
>  status = 
>  major = 2
>  minor = 4.1
>  year = 2006
>  month = 12
>  day = 18
>  svn rev = 40228
>  language = R
>  version.string = R version 2.4.1 (2006-12-18)
> 
> Windows XP Professional (build 2600) Service Pack 2.0
> 
> Locale:
> LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252
> 
> Search Path:
>  .GlobalEnv, package:stats, package:graphics, package:grDevices, package:utils, package:datasets, package:methods, Autoloads, package:base
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel



More information about the R-devel mailing list