2

How to put a spacing of colors in a table of xtable?

I generate the tables with the following instructions:

test.table<-xtable(summary(test),caption='test', floating = FALSE)
align(test.table) <- "|c|l|"
print(test.table,caption.placement='top')

thanks for your answers

Aniko
  • 17,633
  • 4
  • 44
  • 44
ricardo
  • 7,894
  • 9
  • 26
  • 38

2 Answers2

6

The html.table.attributes parameter needs a character vector of length equal to number of tables. This produces a bordered, centered table on a rather ugly yellow-orange background:

data(tli)
tli.table <- xtable(tli[1:20,])
digits(tli.table)[c(2,6)] <- 0
print(tli.table,type="html",
      html.table.attributes='border='1' align="center" bgcolor="#FFCC00"' )

And if you're targeting LaTeX use: tabular.environment=

Gavin Simpson
  • 164,190
  • 25
  • 377
  • 440
IRTFM
  • 251,731
  • 20
  • 347
  • 472
1
html.table.attributes = list('border="1" bgcolor="#FFCC00"'))

will work!

DataCharmer
  • 135
  • 2
  • 6