I wonder how to get LATEX table using xtable function from the following R code.
Block <- gl(8, 4)
A <- factor(c(0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,0,1,
0,1,0,1,0,1,0,1,0,1,0,1))
B <- factor(c(0,0,1,1,0,0,1,1,0,1,0,1,1,0,1,0,0,0,1,1,
0,0,1,1,0,0,1,1,0,0,1,1))
C <- factor(c(0,1,1,0,1,0,0,1,0,0,1,1,0,0,1,1,0,1,0,1,
1,0,1,0,0,0,1,1,1,1,0,0))
Yield <- c(101, 373, 398, 291, 312, 106, 265, 450, 106, 306, 324, 449,
272, 89, 407, 338, 87, 324, 279, 471, 323, 128, 423, 334,
131, 103, 445, 437, 324, 361, 302, 272)
aovdat <- data.frame(Block, A, B, C, Yield)
summary(aov(Yield~Block+A*B+Error(A*Block), data=aovdat))
Error: A
Df Sum Sq Mean Sq
A 1 3465.3 3465.3
Error: Block
Df Sum Sq Mean Sq
Block 7 4499 642.71
Error: A:Block
Df Sum Sq Mean Sq F value Pr(>F)
B 1 41616 41616 3.5354 0.1091
Residuals 6 70628 11771
Error: Within
Df Sum Sq Mean Sq F value Pr(>F)
B 1 119568 119568 7.3751 0.01673 *
A:B 1 28 28 0.0017 0.96734
Residuals 14 226975 16213
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1
Using the following code
xtable(summary(aov(Yield~Block+A*B+Error(A*Block), data=aovdat)))
producing the following error
Error in rbind(deparse.level, ...) :
numbers of columns of arguments do not match
Is it possible to get a LaTeX table like this?
SOV Df Sum Sq Mean Sq F value Pr(>F)
A 1 3465.3 3465.3
Block 7 4499 642.71
B 1 41616 41616 3.5354 0.1091
Residuals 6 70628 11771
B 1 119568 119568 7.3751 0.01673 *
A:B 1 28 28 0.0017 0.96734
Residuals 14 226975 16213
---
Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1