Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
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 > wrote: > > On Wed, Sep 16, 2009

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Henrique Dallazuanna
Try this: sapply(x, format, decimal.mark = ',') On Wed, Sep 16, 2009 at 2:06 PM, Jakson A. Aquino 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

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
On Wed, Sep 16, 2009 at 03:29:44PM +0200, David Hajage wrote: > But, it seems that dcolumn can change the decimal separator too (see the > table on the first page of the pdf document). > > For example: > > \documentclass{article} > > \usepackage{dcolumn} > > \newcolumntype{d}[1]{D{.}{,}{#1}} >

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
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

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread David Hajage
But, it seems that dcolumn can change the decimal separator too (see the table on the first page of the pdf document). For example: \documentclass{article} \usepackage{dcolumn} \newcolumntype{d}[1]{D{.}{,}{#1}} \begin{document} <>= x <- matrix(rnorm(4), 2, 2) library(xtable) xtable(x, align =

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
On Wed, Sep 16, 2009 at 01:59:29PM +0200, David Hajage wrote: > Perhaps with the dcolumn package ? > http://newton.ex.ac.uk/research/qsystems/people/latham/LaTeX/dcolumn.pdf Thanks for the suggestion, but the problem isn't of alignment. When I have commas as decimal separators, the values are alig

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Henrique Dallazuanna
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. On Wed, Sep 16, 2009 at 8:50 AM, Jakson A. Aquino wrote: > On Wed, Sep 16, 2009 at 07:11:46AM +0200, Sc

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread David Hajage
Perhaps with the dcolumn package ? http://newton.ex.ac.uk/research/qsystems/people/latham/LaTeX/dcolumn.pdf David 2009/9/16 Jakson A. Aquino > On Wed, Sep 16, 2009 at 07:11:46AM +0200, Schalk Heunis wrote: > > This might be of help, first applies the > formatting:print(xtable(prettyNum(d, > > d

Re: [R] comma as decimal separator in xtable

2009-09-16 Thread Jakson A. Aquino
On Wed, Sep 16, 2009 at 07:11:46AM +0200, Schalk Heunis wrote: > This might be of help, first applies the formatting:print(xtable(prettyNum(d, > decimal.mark=","))) Thanks! Your solution works for the example that I gave. However, I failed to provide an example that really represent my problem bec

Re: [R] comma as decimal separator in xtable

2009-09-15 Thread Schalk Heunis
This might be of help, first applies the formatting:print(xtable(prettyNum(d, decimal.mark=","))) Schalk Heunis On Tue, Sep 15, 2009 at 5:06 PM, Jakson A. Aquino wrote: > Hello, > > How can I make xtable print a comma as decimal separator? Setting > the option OutDec isn't enough for xtable:

[R] comma as decimal separator in xtable

2009-09-15 Thread Jakson A. Aquino
Hello, How can I make xtable print a comma as decimal separator? Setting the option OutDec isn't enough for xtable: library(xtable) options(OutDec = ",") x <- c(1.1, 1.2, 1.3) y <- c(2.3, 2.2, 2.1) d <- data.frame(x, y) d print(xtable(d)) Thanks! Jakson Aquino __