Używanie R-studio i Knitr do utworzenia pliku pdf Nie mogę uzyskać tabeli wyśrodkowanej w poziomie. Jak widać z poniższego przykładu, działa dobrze przy użyciu xtable(), ale tabele latex() - wszystkie są wyrównane do lewej. Jak rozumiem dokumentację Hmisc, tabele utworzone z lateksu() powinny być automatycznie wyśrodkowane w poziomie, ale muszę zrobić coś złego.Tabele utworzone z latexu() z pakietu Hmisc są wyrównane do lewej strony, zamiast być wyśrodkowane w dokumencie PDF.
\documentclass{article}
\begin{document}
<<>>=
library(Hmisc)
library(tables)
library(xtable)
@
The tables are all left-aligned:
<<results='asis'>>=
latex( tabular((Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris) )
@
<<results='asis'>>=
latex( tabular((Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris),center="center" )
@
<<results='asis'>>=
latex( tabular((Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris),center="centering" )
@
I have tried to use the fig.align option, but it does not do it:
<<results='asis',fig.align='center'>>=
latex( tabular( (Species + 1) ~ (n=1) + Format(digits=2)*(Sepal.Length + Sepal.Width)*(mean + sd), data=iris ) )
@
with xtable it automatically centers:
<<results='asis'>>=
xtable(table(Puromycin$conc, Puromycin$state))
@
\end{document}
wersja R 3.0.0 (2013-04-03)
Platforma: x86_64-W64-mingw32/x64 (64-bit)
Jakie cechy "latexu" są niedostępne, które nie są dostępne w 'xtable'? Wygląda na to, że 'center' jest martwym argumentem. Badam ... –
Xtable() niestety nie akceptuje obiektów tabelarycznych. –