How can I use the R xtable package to produce a table with a colored column? This post shows how to color a row, but I can't figure out how to do the same for columns.
Here is a code snipped that should clarify it. The key is to define a new column type. In this example Iused "a" for the name of the new column and assigned a medium gray to it:
\usepackage{xcolor, colortbl}
\definecolor{Gray}{gray}{0.85}
\newcolumntype{a}{>{\columncolor{Gray}}c}
<<xtable1, results=tex, echo=F>>=
xtab<-xtable(d, caption="...", label="tab.myData")
align(xtab) <- c('l', 'c', 'a')
print(xtab, floating=F, include.rownames = F)
@
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.