Hi all I know about producing a minimal example to show my problem. But I'm having trouble producing a minimal example that displays this behaviour, so please bear with me to begin with.
Observe: I create an array called model.mat. Some details on this: > str(model.mat) num [1:18, 1:4] -0.170 -0.304 -2.617 2.025 -1.610 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:18] "Amount: CP for VF" "Amount: CP for F" "Amount: CP for M" "Amount: RD for VF" ... ..$ : chr [1:4] "beta_0" "P-value" "beta_1" "P-value" It contains the following: > model.mat[1:2,] beta_0 P-value beta_1 P-value Amount: CP for VF -0.1702877 0.7716153 0.5148616 2.020602e-03 Amount: CP for F -0.3042522 0.1966133 0.8795982 6.058299e-12 That's fine. Now to produce a LaTeX table using xtable, I get: > xtable(model.mat[1:2,]) <snip> Amount: CP for VF & $-$0.17 & 0.77 & 0.51 & 0.77 \\ Amount: CP for F & $-$0.30 & 0.20 & 0.88 & 0.20 \\ <snip> That is, the final column does *not* correspond to the final column of model.mat itself. It is actually column 2 repeated. What's going on? If I try repeating on a minimal type example, xtable works as expected: > fred <- array( seq(1,18*4), dim=c(18,4)) > fred[1:2, ] [,1] [,2] [,3] [,4] [1,] 1 19 37 55 [2,] 2 20 38 56 > xtable(fred[1:2, ]) % latex table generated in R 2.5.0 by xtable 1.4-6 package % Thu Sep 13 14:09:46 2007 \begin{table}[ht] \begin{center} \begin{tabular}{rrrrr} \hline & 1 & 2 & 3 & 4 \\ \hline 1 & 1 & 19 & 37 & 55 \\ 2 & 2 & 20 & 38 & 56 \\ \hline \end{tabular} \end{center} \end{table} So it is not a generic problem. But what could it be? I can't decide where to look, so find a solution or produce a minimal example to display this behaviour. I actually use this construct with xtable a lot, so it disturbs me to find this error... which is probably is something I am doing. The problem exists for a smaller subsets of this array also; let's take columns 2, 3 and 4 only: > model.mat[1:2,2:4] P-value beta_1 P-value Amount: CP for VF 0.7716153 0.5148616 2.020602e-03 Amount: CP for F 0.1966133 0.8795982 6.058299e-12 > xtable(model.mat[1:2,2:4]) % latex table generated in R 2.5.0 by xtable 1.4-6 package % Thu Sep 13 14:04:40 2007 \begin{table}[ht] \begin{center} \begin{tabular}{rrrr} \hline & P-value & beta\_1 & P-value \\ \hline Amount: CP for VF & 0.77 & 0.51 & 0.77 \\ Amount: CP for F & 0.20 & 0.88 & 0.20 \\ \hline \end{tabular} \end{center} \end{table} Is it a problem with my particular array model.mat or something I am doing wrong/silly? I don't know where to start. Thanks all, as always. P. > sessionInfo() R version 2.5.0 (2007-04-23) i486-pc-linux-gnu locale: LC_CTYPE=en_AU.UTF-8;LC_NUMERIC=C;LC_TIME=en_AU.UTF-8;LC_COLLATE=en_AU.UTF-8;LC_MONETARY=en_AU.UTF-8;LC_MESSAGES=en_AU.UTF-8;LC_PAPER=en_AU.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_AU.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] "stats" "graphics" "grDevices" "utils" "datasets" "methods" [7] "base" other attached packages: car xtable statmod "1.2-1" "1.4-6" "1.3.0" -- Dr Peter Dunn | dunn <at> usq.edu.au Faculty of Sciences, USQ; http://www.sci.usq.edu.au/staff/dunn Aust. Centre for Sustainable Catchments: www.usq.edu.au/acsc This email (including any attached files) is confidential an...{{dropped}} ______________________________________________ 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.