I am trying to create a table with a numeric column number
which I wish to center and flushright content as follows:
Using RMarkdown, I am only able to wrap LaTeX
code around/inline with cell content in R using the paste0()
as follows, and I am not able to modify the LaTeX tabular
environment:
i.e. table$number <- paste0("\\begin{centering}", table$number, "\\end{centering})
So possible ways to approach this is to use eqmakebox
or multicol
or varwidth
. But my surficial understanding of these commands have not made possible of what I want.
The table in LaTeX
as a reproducible example:
\begin{tabu} to \linewidth {>{\centering}X>{\raggedleft}X}
\hline
\multicolumn{1}{c}{name} & \multicolumn{1}{c}{number}\\
\hline
a & 10\\ % please only make
\hline
bb & 193048\\ % edits in these
\hline
ccc & 200\\ % lines so I can reproduce in R
\hline
\end{tabu}
SO posting with more flavours of R in it
Best Answer