I’m using xtable to manage R output in Sweave. See code below:
CC <- data.frame(
y = c(449, 413, 326, 409, 358, 291, 341, 278, 312)/12,
P = ordered(gl(3, 3)), N = ordered(gl(3, 1, 9))
)
CC.aov <- aov(y ~ N * P, data = CC , weights = rep(12, 9))
Summary <- summary(CC.aov, split = list(N = list(L = 1, Q = 2),
P = list(L = 1, Q = 2)))
Summary
Df Sum Sq Mean Sq
N 2 1016.7 508.3
N: L 1 1012.5 1012.5
N: Q 1 4.2 4.2
P 2 917.4 458.7
P: L 1 917.3 917.3
P: Q 1 0.0 0.0
N:P 4 399.3 99.8
N:P: L.L 1 184.1 184.1
N:P: Q.L 1 152.1 152.1
N:P: L.Q 1 49.0 49.0
N:P: Q.Q 1 14.1 14.1
I like to indent the first column as shown in the output above. But when I use xtable(Summary) the first column is aligned left. I know how to align left, right or center but could not figure out how to get the output as indented in the first.
This example shows how to customize the table combining the use of the
sanitizeargument in xtable and the function\hskipin latex.The code would be:
EDIT: Following Dwin’s suggestion of using
That provides a more general solution. The code would change to: