On Wed, Sep 16, 2009 at 03:16:12PM -0300, Henrique Dallazuanna wrote:
> Try this:
> 
> sapply(x, format, decimal.mark = ',')

Yes, this works as I need, regarding the replacement of dots with
commas.

Thanks!

> 
> On Wed, Sep 16, 2009 at 2:06 PM, Jakson A. Aquino
> <jaksonaqu...@gmail.com> wrote:
> > On Wed, Sep 16, 2009 at 09:14:39AM -0300, Henrique Dallazuanna wrote:
> >> Try this also;
> >>
> >> format(coef(summary(lm.D9)), decimal.mark = ',')
> >>
> >> or using gsub:
> >>
> >>  apply(coef(summary(lm.D9)), 2, gsub, pattern = "\\.", replacement = ",")
> >>
> >> using lm.D9 object from ?lm example.
> >
> > Thanks for your suggestion! The problem with the above approach is
> > that all values get the same formatting. For example,
> >
> > x <- c(1.2, 1.2e10)
> > format(x, format = 'g', decimal.mark = ',')
> > [1] "1,2e+00" "1,2e+10"
> >
> > What I would like to get was:
> > [1] "1,2" "1,2e+10"

______________________________________________
R-help@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.

Reply via email to