[R] How to avoid rounding of matrix elements?

Tim F Liao tfliao at uiuc.edu
Fri Jan 7 01:44:37 CET 2005


The signif() function doesn't increase the number 
significant digits beyond the default.  However, if your 
purpose is simply to see more digits (or what was entered), 
a paste() function will do the trick though it will trim the 
trailing zeros.  Other ways?

Tim

---- Original message ----
>Date: Thu, 06 Jan 2005 18:57:03 -0500
>From: Ulas Karaoz <ulask at bu.edu>  
>Subject: [R] How to avoid rounding of matrix elements?  
>To: R-help at stat.math.ethz.ch
>
>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.010500
2420,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




More information about the R-help mailing list