[R] decimal troubles ?

Peter Alspach PAlspach at hortresearch.co.nz
Tue May 12 10:29:32 CEST 2009


Tena koe Patrick

If you want more than three digits, change the options:

options(digits=7)
44.25+31.1+50
[1] 125.35

HTH ....

Peter Alspach 

> -----Original Message-----
> From: r-help-bounces at r-project.org 
> [mailto:r-help-bounces at r-project.org] On Behalf Of Patrick Giraudoux
> Sent: Tuesday, 12 May 2009 8:08 p.m.
> To: r-help at r-project.org
> Subject: [R] decimal troubles ?
> 
> Dear all,
> 
> I have some trouble with the number of decimals in R 
> (currently R 2.9.0). For instance:
> 
>  > options()$digits
> [1] 3
> 
> let me hope that I will get three digits where useful when a 
> number is printed. BUT:
> 
>  > 44.25+31.1+50
> [1] 125
> 
> No way to get the right result 125.35
> 
> Can anybody tell me what's happens ?
> 
> Patrick
> 
> ______________________________________________
> R-help at r-project.org 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.
> 

The contents of this e-mail are confidential and may be subject to legal privilege.
 If you are not the intended recipient you must not use, disseminate, distribute or
 reproduce all or any part of this e-mail or attachments.  If you have received this
 e-mail in error, please notify the sender and delete all material pertaining to this
 e-mail.  Any opinion or views expressed in this e-mail are those of the individual
 sender and may not represent those of The New Zealand Institute for Plant and
 Food Research Limited.




More information about the R-help mailing list