[R] reading large numbers

Sarah Goslee sarah.goslee at gmail.com
Wed Oct 12 21:52:53 CEST 2011


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 <chettyvk at gmail.com> 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



More information about the R-help mailing list