> formatC(0.0001, format = "f", digits = 4)

works fine for this case. however, i need a way to automatize this,
i.e. to change the default behaviour of print.default!? how could this
be done? the problem with applying the above solution to a number
which is the result of a function, say, is that one has to know
beforehand the number of digits, since

> formatC(1e-04,format="f",digits=5)
[1] "0.00010"

which is also unwanted. 

thanks a lot so far!

tomy


"Marc Schwartz" <[EMAIL PROTECTED]> writes:

>>-----Original Message-----
>>From: [EMAIL PROTECTED] 
>>[mailto:[EMAIL PROTECTED] On Behalf Of Thomas Gerds
>>Sent: Monday, February 24, 2003 11:01 AM
>>To: [EMAIL PROTECTED]
>>Subject: [R] printing decimal numbers
>>
>>
>>hi,
>>
>>this is a very basic question -- sorry for posing it:
>>     
>>how can i force R to print 0.0001 instead of 1e-04???
>>
>>.--------------------.
>>| > 0.0001           |
>>| [1] 1e-04          |
>>`--------------------'
>>
>>i tried the functions format, formatC, ... and changed 
>>options()$digits with no success!
>>
>>thanks for advice,
>>tomy
>
>
> Try:
>
>> formatC(0.0001, format = "f", digits = 4)
> [1] "0.0001"
>
> Be sure to use the 'format = "f"' argument.
>
> See ?formatC
>
> HTH,
>
> Marc Schwartz

-- 
no signature

______________________________________________
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to