Skip to content

round up a number to 10^4

8 messages · wendy, David Winsemius, michael.weylandt at gmail.com (R. Michael Weylandt +5 more

#
Hi all, 

I have a list of numbers, e.g., X = c(60593.23, 71631.17, 75320.1), and want
to round them  so the output is Y = c(60000, 80000, 80000). I tried
Y<-round(X,-4), but it gives me Y = c(60000, 70000, 80000). Do anybody know
how to round up a number to 10^4?

Thank you in advance.

Wendy


--
View this message in context: http://r.789695.n4.nabble.com/round-up-a-number-to-10-4-tp3964394p3964394.html
Sent from the R help mailing list archive at Nabble.com.
#
On Nov 1, 2011, at 1:07 PM, Wendy wrote:

            
Under what notion of "rounding" would that be the result?

  
    
Could you divide by your desired order of magnitude, use ceiling and then re-multiply?

Michael
On Nov 1, 2011, at 3:42 PM, David Winsemius <dwinsemius at comcast.net> wrote:

            
#
Or does the middle number have two digits switched? 76131.17 would 
round up to 80000 very nicely.
#
Also be aware of the IEEE standard of rounding to even:
[1] 60000
[1] 60000
[1] 60000
[1] 70000
[1] 80000
[1] 80000
notice what 65000 rounds to and what 75000 rounds to.
On Tue, Nov 1, 2011 at 4:13 PM, Bert Gunter <gunter.berton at gene.com> wrote:

  
    
#
Bert,

How do you define "elementary"?  And, do we play this like "Name That Tune"?  "Bert, I can do that calculation in X operations."  Or, maybe like Jeopardy,  "What is the number X?"  Or maybe we could play "Are You Smarter Than a Seventh-Grader?"  I'm just asking.


Dan

Daniel J. Nordlund
Washington State Department of Social and Health Services
Planning, Performance, and Accountability
Research and Data Analysis Division
Olympia, WA 98504-5204
#
Works in the newly released 2.14.0:
[1] 60000 70000 80000

Dennis
On Tue, Nov 1, 2011 at 10:07 AM, Wendy <wendy2.qiao at gmail.com> wrote: