On Wed, 2 Jan 2008, jim holtman wrote:
>> sprintf("%.4f", 0.0002234)
> [1] "0.0002"
Or, literally for printing, use options(scipen=). Note that
round(0.0002234,4) does return (a representable number very close to)
0.0002, but it is printed by default as 2e-04.
> round(0.0002234,4)
[1] 2e-04> options(scipen=4)
> round(0.0002234,4)
[1] 0.0002
>
>
> On Jan 2, 2008 1:45 PM, array chip <arrayprofile at yahoo.com> wrote:
>> Hi,
>>
>> The code round(0.0002234,4) will return 2e-04, how can
>> I return 0.0002 instead? I want to print 0.0002
>> instead of 2e-04 for formating purpose.
>>
>> thanks
>>
>>
>>
____________________________________________________________________________________
>> Looking for last minute shopping deals?
>>
>> ______________________________________________
>> 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.
>>
>
>
>
>
--
Brian D. Ripley, ripley at stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595