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 because I'm passing a lm object to xtable. Currently, I'm using the following function, which also puts the table header in bold font: tabprint <- function(x, ...) { colsani <- function(x){paste("{\\bf ", x, "}", sep = "")} p <- capture.output(print(x, caption.placement = "top", sanitize.colnames.function = colsani, ...)) writeLines(p, "/tmp/xtableOutPut") system("sed -i -e 's/\\([0-9]\\)\\.\\([0-9]\\)/\\1,\\2/g' /tmp/xtableOutPut") p <- readLines("/tmp/xtableOutPut") cat(p, sep = "\n") } tabprint(xtable(lm.model)) I could call gsub() if I knew the perl regular expression equivalent to the sed one that I'm using. > On Tue, Sep 15, 2009 at 5:06 PM, Jakson A. Aquino > <jaksonaqu...@gmail.com>wrote: > > > 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 > > > > ______________________________________________ > > 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. > > > > [[alternative HTML version deleted]] > > ______________________________________________ > 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. ______________________________________________ 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.