0

Something similar like here (c#):

GridView with merged cells

I have tried package gridExtra and function tableGrob and grid.arrange. They create nice (e.g. png) images out of data.frames but I haven't found a way to merge cells using them.

My goal is create table images I can embed using knitr and markdown.

EDIT per Thomas K's comment:

p1 <- gridExtra::tableGrob(1)
nf <- matrix(c(2,3,1,1), byrow=TRUE, nrow=2)
grid.arrange(p1,p1,p1, layout_matrix = nf)

EDIT per bdecaf's comment:

require(pander)
a <- array(1:8, dim = c(2,2,2), dimnames= rep(list(letters[1:2]),3))
pander(ftable(a))

This gives a usable solution!

**It seems this is a duplicate of:

R: remove repeating row entries in gridExtra table **

Community
  • 1
  • 1
Sonia
  • 325
  • 1
  • 12
  • Please create a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with code which shows what you have tried so far. – Thomas K Sep 27 '15 at 10:00
  • It really depends where the data comes from. `pander` has a very nice output for `ftable` - though that outputs a table and not an image. But maybe you can use that for your case as well. – bdecaf Sep 27 '15 at 10:20
  • @bdecaf: Thanks, I will look into that. I'm perfectly okay with anything that produces nice html-table. – Sonia Sep 27 '15 at 12:17

0 Answers0