# [R] round up a number to 10^4

Nordlund, Dan (DSHS/RDA) NordlDJ at dshs.wa.gov
Tue Nov 1 21:57:17 CET 2011

```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

> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of Bert Gunter
> Sent: Tuesday, November 01, 2011 1:13 PM
> To: David Winsemius
> Cc: r-help at r-project.org; Wendy
> Subject: Re: [R] round up a number to 10^4
>
> Yes, I agree with David that this looks like an error.
>
> However, for fun, one might ask: what is the fewest number of R
> elementary
> math operations that would produce such a result -- this might be good
> for
> clever 6th or 7th graders, for example.
>
> For here, I leave this as an exercise for the reader.
>
> -- Bert
>
> On Tue, Nov 1, 2011 at 12:42 PM, David Winsemius
> <dwinsemius at comcast.net>wrote:
>
> >
> > On Nov 1, 2011, at 1:07 PM, Wendy wrote:
> >
> >  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).
> >>
> >
> > Under what notion of "rounding" would that be the result?
> >
> >  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.
> >>
> >
> >
> > --
> > David Winsemius, MD
> > Heritage Laboratories
> > West Hartford, CT
> >
> > ______________________________**________________
> > R-help at r-project.org mailing list
> > https://stat.ethz.ch/mailman/**listinfo/r-
> help<https://stat.ethz.ch/mailman/listinfo/r-help>
> > posting-guide.html <http://www.R-project.org/posting-guide.html>
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
>
>
> --
>
> Bert Gunter
> Genentech Nonclinical Biostatistics
>
> Internal Contact Info:
> Phone: 467-7374
> Website:
> biostatistics/pdb-ncb-home.htm
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help