That is what it is supposed to do. From ?round we get "Note that for rounding off a 5, the IEC 60559 standard is expected to be used, “go to the even digit”. Therefore round(0.5) is 0 and round(-1.5) is -2. However, this is dependent on OS services and on representation error (since e.g. 0.15 is not represented exactly, the rounding rule applies to the represented number and not to the printed number, and so round(0.15, 1) could be either 0.1 or 0.2). "
Monica Pisica wrote: > Hi, > > I am getting some strange results using round - it seems that it depends if > the number before the decimal point is odd or even .... > > For example: > >> round(1.5)[1] 2> round(2.5)[1] 2 > While i would expect that round(2.5) be 3 and not 2. > > Do you have any explanation for that? > > I really appreciate your input, > > Monica > > > _________________________________________________________________ > [[trailing spam removed]] > > [[alternative HTML version deleted]] > > ______________________________________________ > [email protected] 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. > -- David C. Howell PO Box 770059 627 Meadowbrook Circle Steamboat Springs, CO 80477 ______________________________________________ [email protected] 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.
