I'm trying to produce a summary of a logistic regression Analysis of Deviance table, but the result is a block of what I think is LaTex. Here is my code:
m1 <- glm(vote ~ factor(income),
data = nes1992,
family = binomial)
xtable(summary(anova(m1)))
The output to the .PDF looks like this:
\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}
\hline
& Estimate & Std. Error & z value & Pr($>$$|$z$|$) \\
\hline
(Intercept) & -1.1838 & 0.2087 & -5.67 & 0.0000 \\
factor(income)2 & 0.4906 & 0.2555 & 1.92 & 0.0548 \\
factor(income)3 & 0.7509 & 0.2345 & 3.20 & 0.0014 \\
factor(income)4 & 1.1243 & 0.2312 & 4.86 & 0.0000 \\
factor(income)5 & 1.2378 & 0.3125 & 3.96 & 0.0001 \\
\hline
\end{tabular}
\end{table}
I am working in an .Rmd file and knitting the document to a .PDF file. I'm not sure if I'm doing something wrong or if there is a larger technical issue I need to address. Any help is appreciated.
I updated my code to reflect the documentation requirements, but I'm still getting the unformatted code chunk when I print:
m1table <- xtable(summary(m1))
print(m1table, type = "latex")