Xtable and Sweave
when you do this, you need:
<<echo=false, results=hide>>=
xtab <- xtable(ABC, align="lrrrrr")
@
the l will left align the row names. Please remember the align argument takes 1+ncol as the number of elements. So if you have 5 columns, you would do lrrrrr, if you have 4 columns, you would do lrrrr. Note: l=left, r=right, c=center.
Then,
<<echo=false, results=tex>>=
print(xtab, floating=FALSE)
@
This should work. If you were using the knitr syntax, you would need, echo=FALSE, results='hide' and later, results='asis'
Related videos on Youtube
Micha
Updated on August 01, 2022Comments
-
Micha over 1 year
My question is regarding
xtable
andsweave
. I have a certain table created in RStudio and want to create a pdf file using it. I use the package Sweave and write the necessary code and I get the table. Unfortunately, the rownames of the table are aligned to the right instead to the left. How can I avoid or rectify this? Any suggestions would be well appreciated.\rowcolors{2}{white!65}{cyan!35} \begin{center} <<xtable1,results=tex,echo=FALSE>>= xtab<-xtable(ABC) print(xtab,center = "centering", floating=FALSE) @ \end{center}