I would like to have a footnote in a cell of a latex table. Usually I would do it with:
... & $^{1)} $ ...
How can I get this using xtable? The following is a minimal example and I tried several ways to get what I want:
\documentclass[9pt]{article}
\begin{document}
<<echo=TRUE>>=
df0 <- data.frame(x=c(1:5), y=c('a','b','c','d','e'))
df0$y <- as.character(df0$y)
df0$y[df0$y=="a"] <- "$^{1)}$"
df0$y[df0$y=="b"] <- "$\\^{2)}$"
df0$y[df0$y=="c"] <- "$^3$"
df0$y[df0$y=="d"] <- "$\\^4$"
df0$y[df0$y=="e"] <- "\\$\\^4\\$"
df0
@
<<echo=FALSE, results="asis">>=
xtable(df0)
@
\end{document}
Any hint appreciated.
See ?print.xtable
and check out the sanitize options.
Use your original LaTeX method of inclusion then something like this should work...
<<echo=FALSE, results="asis">>=
require(xtable)
tbl <- xtable(df0)
print(tbl, type="latex", sanitize.text.function=function(x){x})
@
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.