reading large numbers

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

reading large numbers

Veerappa Chetty
Hi,
This happens when I read in large numbers;
------------------------------------
> as.numeric(4398801.3)
[1] 4398801

> as.numeric(439880.3)
[1] 439880.3
------------------------------------
Please help to read in numbers with more than 8 characters!
Thanks.
Chetty

--
Professor of Family Medicine
Boston University
Tel: 617-414-6221, Fax:617-414-3345
emails: [hidden email],[hidden email]

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: reading large numbers

Michael Weylandt
Like I said on the other thread you started on this same issue, this
is just a print setting, not something with the data.

Consider this:

R>  as.numeric(4398801.3) ==  4398801.3
TRUE

If you want to change this, try

options(digits = 14) # or however many you want to see

And don't jump ship on threads where we've started on a topic, it just
confuses the matter

Michael

On Wed, Oct 12, 2011 at 3:47 PM, Veerappa Chetty <[hidden email]> wrote:

> Hi,
> This happens when I read in large numbers;
> ------------------------------------
>> as.numeric(4398801.3)
> [1] 4398801
>
>> as.numeric(439880.3)
> [1] 439880.3
> ------------------------------------
> Please help to read in numbers with more than 8 characters!
> Thanks.
> Chetty
>
> --
> Professor of Family Medicine
> Boston University
> Tel: 617-414-6221, Fax:617-414-3345
> emails: [hidden email],[hidden email]
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: reading large numbers

Sarah Goslee
In reply to this post by Veerappa Chetty
I believe you were already answered.

Nothing is happening to your numbers. The default digits
used to *display* your numbers is too small to show all
the decimal places.

There's nothing to worry about; full precision is being used
for all calculations.

But if for some reason you'd like to see them, you can
change the default digits used for printing:

> as.numeric(4398801.3)
[1] 4398801
> as.numeric(439880.3)
[1] 439880.3
>
> options()$digits
[1] 7
>
> options(digits=14)
>
> as.numeric(4398801.3)
[1] 4398801.3
> as.numeric(439880.3)
[1] 439880.3

Sarah

On Wed, Oct 12, 2011 at 3:47 PM, Veerappa Chetty <[hidden email]> wrote:

> Hi,
> This happens when I read in large numbers;
> ------------------------------------
>> as.numeric(4398801.3)
> [1] 4398801
>
>> as.numeric(439880.3)
> [1] 439880.3
> ------------------------------------
> Please help to read in numbers with more than 8 characters!
> Thanks.
> Chetty
>

--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
[hidden email] 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.