help with e+01 number abbreviations

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

help with e+01 number abbreviations

Gian
Dear List,

I will appreciate any advice regarding how to convert the following numbers
[I got in return by taxondive()] in numeric integers without the e.g.
6.4836e+01
abbreviations.
Thank you very much in advance,

Gian

> taxa_dive
             Species       Delta      Delta*     Lambda+      Delta+ S
Delta+
Nat1      5.0000e+00  6.4836e+01  9.5412e+01  6.7753e+02  8.7398e+01
436.99
Nat2      2.0000e+00  4.0747e+01  1.0000e+02  0.0000e+00  1.0000e+02
200.00
Nat3      3.0000e+00  4.5381e+01  7.7652e+01  2.8075e+02  8.8152e+01
264.46
....

        [[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: help with e+01 number abbreviations

Petr Savicky
On Thu, Feb 16, 2012 at 10:17:09AM +0100, Gian Maria Niccolò Benucci wrote:

> Dear List,
>
> I will appreciate any advice regarding how to convert the following numbers
> [I got in return by taxondive()] in numeric integers without the e.g.
> 6.4836e+01
> abbreviations.
> Thank you very much in advance,
>
> Gian
>
> > taxa_dive
>              Species       Delta      Delta*     Lambda+      Delta+ S
> Delta+
> Nat1      5.0000e+00  6.4836e+01  9.5412e+01  6.7753e+02  8.7398e+01
> 436.99
> Nat2      2.0000e+00  4.0747e+01  1.0000e+02  0.0000e+00  1.0000e+02
> 200.00
> Nat3      3.0000e+00  4.5381e+01  7.7652e+01  2.8075e+02  8.8152e+01
> 264.46
> ....

Hi.

The exponential format was used probably due to some small
numbers. For example

  tst <- rbind(
  c( 5.0000e+00, 6.4836e+01, 9.5412e+01, 6.7753e+02, 8.7398e+01, 436.99),
  c( 2.0000e+00, 4.0747e+01, 1.0000e+02, 0.0000e+00, 1.0000e+02, 200.00),
  c( 3.0000e+00, 4.5381e+01, 7.7652e+01, 2.8075e+02, 8.8152e+01, 264.46),
  c( 1e-8,       1e-8,       1e-8,       1e-8,       1e-8,       1 ))

  tst

        [,1]       [,2]       [,3]       [,4]       [,5]   [,6]
  [1,] 5e+00 6.4836e+01 9.5412e+01 6.7753e+02 8.7398e+01 436.99
  [2,] 2e+00 4.0747e+01 1.0000e+02 0.0000e+00 1.0000e+02 200.00
  [3,] 3e+00 4.5381e+01 7.7652e+01 2.8075e+02 8.8152e+01 264.46
  [4,] 1e-08 1.0000e-08 1.0000e-08 1.0000e-08 1.0000e-08   1.00

Try roudning the numbers, for example

  round(tst, digits=4)

       [,1]   [,2]    [,3]   [,4]    [,5]   [,6]
  [1,]    5 64.836  95.412 677.53  87.398 436.99
  [2,]    2 40.747 100.000   0.00 100.000 200.00
  [3,]    3 45.381  77.652 280.75  88.152 264.46
  [4,]    0  0.000   0.000   0.00   0.000   1.00

Alternatively, options(scipen=20) forces a fixed point printing
with more digits.

  options(scipen=20)
  tst

             [,1]        [,2]         [,3]         [,4]         [,5]   [,6]
  [1,] 5.00000000 64.83600000  95.41200000 677.53000000  87.39800000 436.99
  [2,] 2.00000000 40.74700000 100.00000000   0.00000000 100.00000000 200.00
  [3,] 3.00000000 45.38100000  77.65200000 280.75000000  88.15200000 264.46
  [4,] 0.00000001  0.00000001   0.00000001   0.00000001   0.00000001   1.00

Hope this helps.

Petr Savicky.

______________________________________________
[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: help with e+01 number abbreviations

glsnow
Also look at the zapsmall function.  A useful but often overlooked tool.

On Thu, Feb 16, 2012 at 2:54 AM, Petr Savicky <[hidden email]> wrote:

> On Thu, Feb 16, 2012 at 10:17:09AM +0100, Gian Maria Niccolò Benucci wrote:
>> Dear List,
>>
>> I will appreciate any advice regarding how to convert the following numbers
>> [I got in return by taxondive()] in numeric integers without the e.g.
>> 6.4836e+01
>> abbreviations.
>> Thank you very much in advance,
>>
>> Gian
>>
>> > taxa_dive
>>              Species       Delta      Delta*     Lambda+      Delta+ S
>> Delta+
>> Nat1      5.0000e+00  6.4836e+01  9.5412e+01  6.7753e+02  8.7398e+01
>> 436.99
>> Nat2      2.0000e+00  4.0747e+01  1.0000e+02  0.0000e+00  1.0000e+02
>> 200.00
>> Nat3      3.0000e+00  4.5381e+01  7.7652e+01  2.8075e+02  8.8152e+01
>> 264.46
>> ....
>
> Hi.
>
> The exponential format was used probably due to some small
> numbers. For example
>
>  tst <- rbind(
>  c( 5.0000e+00, 6.4836e+01, 9.5412e+01, 6.7753e+02, 8.7398e+01, 436.99),
>  c( 2.0000e+00, 4.0747e+01, 1.0000e+02, 0.0000e+00, 1.0000e+02, 200.00),
>  c( 3.0000e+00, 4.5381e+01, 7.7652e+01, 2.8075e+02, 8.8152e+01, 264.46),
>  c( 1e-8,       1e-8,       1e-8,       1e-8,       1e-8,       1 ))
>
>  tst
>
>        [,1]       [,2]       [,3]       [,4]       [,5]   [,6]
>  [1,] 5e+00 6.4836e+01 9.5412e+01 6.7753e+02 8.7398e+01 436.99
>  [2,] 2e+00 4.0747e+01 1.0000e+02 0.0000e+00 1.0000e+02 200.00
>  [3,] 3e+00 4.5381e+01 7.7652e+01 2.8075e+02 8.8152e+01 264.46
>  [4,] 1e-08 1.0000e-08 1.0000e-08 1.0000e-08 1.0000e-08   1.00
>
> Try roudning the numbers, for example
>
>  round(tst, digits=4)
>
>       [,1]   [,2]    [,3]   [,4]    [,5]   [,6]
>  [1,]    5 64.836  95.412 677.53  87.398 436.99
>  [2,]    2 40.747 100.000   0.00 100.000 200.00
>  [3,]    3 45.381  77.652 280.75  88.152 264.46
>  [4,]    0  0.000   0.000   0.00   0.000   1.00
>
> Alternatively, options(scipen=20) forces a fixed point printing
> with more digits.
>
>  options(scipen=20)
>  tst
>
>             [,1]        [,2]         [,3]         [,4]         [,5]   [,6]
>  [1,] 5.00000000 64.83600000  95.41200000 677.53000000  87.39800000 436.99
>  [2,] 2.00000000 40.74700000 100.00000000   0.00000000 100.00000000 200.00
>  [3,] 3.00000000 45.38100000  77.65200000 280.75000000  88.15200000 264.46
>  [4,] 0.00000001  0.00000001   0.00000001   0.00000001   0.00000001   1.00
>
> Hope this helps.
>
> Petr Savicky.
>
> ______________________________________________
> [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.



--
Gregory (Greg) L. Snow Ph.D.
[hidden email]

______________________________________________
[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.