# Latex Tables and the xtable' package

Hi All,

I've recently been trying to generate some Latex formatted tables using the 'xtable' package in R.

However, the formatting of some of the columns is different from the original output.

A snapshot of my original output is given:

print(postClassProbs(trial.lca4), row.names = FALSE)

MR Mob SC Act Pain Anx Freq      Class 1      Class 2     Class 3
0   0  0   0    0   0 2845 2.642918e-06 8.776227e-01 0.067042881
0   0  0   0    0   1  911 4.391841e-07 9.293405e-01 0.030696931
0   0  0   0    1   0  616 8.220266e-07 9.226063e-01 0.062474787
0   0  0   0    1   1  683 1.072411e-07 9.719491e-01 0.020051938


However, when I run the xtable command, I get:

xtable(print(postClassProbs(trial.lca4), row.names = FALSE))

\begin{table}[ht]
\centering
\begin{tabular}{rrrrrrrrrrrr}
\hline
& MR & Mob & SC & Act & Pain & Anx & Freq & Class 1 & Class 2 & Class 3 & Class 4 \\
\hline
1 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 2845.00 & 0.00 & 0.88 & 0.07 & 0.06 \\
2 & 0.00 & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 911.00 & 0.00 & 0.93 & 0.03 & 0.04 \\
3 & 0.00 & 0.00 & 0.00 & 0.00 & 1.00 & 0.00 & 616.00 & 0.00 & 0.92 & 0.06 & 0.01 \\


In other words, I'd like to ensure that zeroes and ones remain as single numbers, yet xtable changes the format.

Would anyone know how to amend this?

Any help appreciated

xtable(postClassProbs(trial.lca4), row.names = FALSE, digits =c(0,0,0,0,0,0,0,0,4,4,4,4))`