Try
sprintf("%.2f", m)
On 3/22/07, Baoqiang Cao <[EMAIL PROTECTED]> wrote:
> Dear All,
>
> I was trying to format a numeric vector (100*1) by using
> outd <- format(x=m, sci=F, digits=2)
>
> > outd[1:10]
> [1] " 0.01787758" "-0.14760306" "-0.45806041" "-0.67858525" "-0.64591748"
> [6] "-0.05918100" "-0.25632276" "-0.15980138" "-0.08359873" "-0.37866688"
> >m[1:10]
> [1] 0.017878 -0.147603 -0.458060 -0.678585 -0.645917 -0.059181 -0.256323
> [8] -0.159801 -0.083599 -0.378667
>
> I'm expecting something like, 0.02 -0.15 ...
>
______________________________________________
[email protected] 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.