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"

I already solved my problem, but I'm using an external program to
replace "." with ",". Perhaps I should ask my question again, with a
new subject, since what I need now is the perl regular expression
equivalent to the sed command:

s/\([0-9]\)a/a\1/

That's is, "1a" becomes "a1"; "3b" becomes "b3", etc.

______________________________________________
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