R: Creating Latex tables without environment code -
R: Creating Latex tables without environment code -
how can print latex-formatted tables (e.g. summary statistics, no regression output) in r, without environment code \begin{table}[!htbp] \centering
?
i tried many packages listed in tools making latex tables in r. stargazer bundle seems have alternative suppressing latex environment code, namely out.header=false
. alternative seems have no effect. other packages seem haven less options.
background: have 2 table of similar kind (spearman , pearson correlation, in case) have in 1 table in latex. think of calling r generated, latex-formatted output in 3rd latex file, called in latex document. if there other possibilities create 2 r generated latex-style tables in 1 .tex
document, i'd glad utilize them.
you can xtable:
here's default behavior:
> print(xtable(table(1:5))) % latex table generated in r 3.1.1 xtable 1.7-4 bundle % sat nov 08 14:57:56 2014 \begin{table}[ht] \centering \begin{tabular}{rr} \hline & v1 \\ \hline 1 & 1 \\ 2 & 1 \\ 3 & 1 \\ 4 & 1 \\ 5 & 1 \\ \hline \end{tabular} \end{table}
if include floating = false
in print
method options, can desired result:
> print(xtable(table(1:5)), floating = false) % latex table generated in r 3.1.1 xtable 1.7-4 bundle % sat nov 08 14:57:51 2014 \begin{tabular}{rr} \hline & v1 \\ \hline 1 & 1 \\ 2 & 1 \\ 3 & 1 \\ 4 & 1 \\ 5 & 1 \\ \hline \end{tabular}
there's fine-grained command here, of options described in ? print.xtable
, not ? xtable
.
r latex
Comments
Post a Comment