[R] How to avoid rounding of matrix elements?
Don MacQueen
macq at llnl.gov
Fri Jan 7 02:36:17 CET 2005
It's not being rounded, as this example will show:
> x <- 0.1234567898765
> x
[1] 0.1234568
> print(x,digits=15)
[1] 0.1234567898765
It is being printed, or displayed, with fewer digits. But the
underlying value has not changed.
-Don
At 6:57 PM -0500 1/6/05, Ulas Karaoz wrote:
>Hi all R-users,
>If I have a matrix with numeric elements as follows, the values are
>rounded when I try to refer to a specifici element using [], the
>value is rounded.
>The same thing happens if the matrix is read from a file, the values
>are stored to the correct precision but then when I try to refer to
>a specific element (such as using [], it is rounded.
>
>How do I avoid this rounding?
> >mdat<-matrix(c(0.0187972950,0.4446208550,1.0000000000,0.0003204380,0.0105002420,1.1087556380,0.0742164230,0.0362898240),
>nrow = 2, ncol=4)
>> mdat
> [,1] [,2] [,3] [,4]
>[1,] 0.01879729 1.000000000 0.01050024 0.07421642
>[2,] 0.44462085 0.000320438 1.10875564 0.03628982
>
>Thanks.
>
>______________________________________________
>R-help at stat.math.ethz.ch mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
More information about the R-help
mailing list