I would like to create a Latex table in R with the xtable package, which prints some Latex command (in this case \small\sf) between \begin{table} and the caption, like this:
\begin{table}
\small\sf\centering
\caption{This is a table}
\begin{tabular}{l}
Some table \\
\end{tabular}
\end{table}
I looked into the arguments of print.xtable(), but could not find anything helpful. Does anyone know whether there is a way to achieve that?
Here is a MWE:
set.seed(230)
DF <- data.frame(a = rnorm(5), b = rnorm(5), c = rnorm(5))
print.xtable(xtable(DF, caption = "This is a table"), caption.placement = "top")
Which gives:
% latex table generated in R 4.2.1 by xtable 1.8-4 package
% Thu Dec 7 15:58:13 2023
\begin{table}[ht]
\centering
\caption{This is a table}
\begin{tabular}{rrrr}
\hline
& a & b & c \\
\hline
1 & -0.23 & 0.04 & 1.34 \\
2 & 0.10 & 0.57 & -1.62 \\
3 & 0.33 & -0.14 & 0.83 \\
4 & 0.36 & -0.75 & 0.20 \\
5 & 0.44 & 0.13 & -0.49 \\
\hline
\end{tabular}
\end{table}