I\'m struggling with a tables package, all the examples in the packable docs are so complex and none of them works for me with knitr
and latex. Could somebody h
I don't think that this is possible with RMarkdown if you want the table to be in LaTeX style. However, you can easily do this with the xtable
package when you write your code in an .Rnw
file:
\documentclass{article}
\begin{document}
<<>>=
library("xtable")
df <- data.frame(matrix(1:9, nrow = 3))
colnames(df) <- c("first column", "second $\\frac{1}{2}$",
"third column")
@
<>=
print(xtable(df), floating = TRUE,
sanitize.colnames.function = identity, type = "latex")
@
\end{document}