1
votes

I'm using xtable to convert an R table into an object, which can then be printed as a LaTeX table. In this table, I need single numbers to be printed in different colors. Therefore, I already substituted these numbers before applying the xtable function using

paste0("\\textcolor{black!25!green}{",x.tab[[4]][i],"}",sep="")

where x.tab is my R table.

The .tex file looks fine and is compiling without any error. Still, I need these colored numbers, that are captured in a string now, with a decimal comma. All non-colored numbers are in the right format, because I use

format.args = list(big.mark = ".", decimal.mark = ",")

in my print function.

Any help is much appreciated!

2

2 Answers

2
votes

In my case, using options(OutDec = ",") does the trick.

0
votes

Use prettyNum function to set your format :

x <- c(1.6, 2.8, 1.3)
y <- c(0.067, 8.1, 7.55)
d <- data.frame(x, y) 
print(xtable(prettyNum(d,decimal.mark=",")))