I have data tables (d1 and d2) which I would like to print side by side or on top of each other in latex with their own individual titles. Is it possible to do that directly with xtable()? The two tables should be distinct, i.e. we could call them Table x(a) and Table x(b), but they should be either adjacent, or stacked.
I have data tables (d1 and d2) which I would like to print side
Share
I would recommend saving the results as two separate tables in different files (see the
file=option toprint.xtable()), and theninputthem into your LaTeX document with any command you find appropriate for your layout (tabular,subfloat,minipage, etc.). This is what I do in general, although I generally rely on LaTeX facilities in the Hmisc package. Should you want only to print them as a standalone PDF, use thestandaloneclass for your document.So, here is an example:
then, a quick tex wrapper (compile with
pdflatex):Here is the result:
Remove the
\scaleboxcommand for default (stacked) layout, unless they are narrow enough to fit at their default size, as noted by @David.