[R] how to control the data type

Berton Gunter gunter.berton at gene.com
Sat Apr 22 01:45:50 CEST 2006


print(rnorm(1),digits=3)

The key is understanding the difference between the value and what is
printed automatically with the default number of digits given by the
options() value currently in effect.

?options  for "digits"

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 

> -----Original Message-----
> From: r-help-bounces at stat.math.ethz.ch 
> [mailto:r-help-bounces at stat.math.ethz.ch] On Behalf Of John Kane
> Sent: Friday, April 21, 2006 3:59 PM
> To: zhongmiao wang; r-help at stat.math.ethz.ch
> Subject: Re: [R] how to control the data type
> 
> Have a look at  ?round for one way. 
> 
> ----- Original Message ----
> From: zhongmiao wang <zhongmiao at gmail.com>
> To: r-help at stat.math.ethz.ch
> Sent: Thursday, April 20, 2006 11:00:25 PM
> Subject: [R] how to control the data type
> 
> Hello:
> I am generating a random number with rnorm(1). The generated number
> has 8 decimals. I don't want so many decimals. How to control the
> number of decimals in R?
> Thanks!
> 
> Zhongmiao Wang
> 
> ______________________________________________
> 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
> 
> ______________________________________________
> 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