Saturday, 28 September 2013

R: remove repeating row entries in gridExtra table

R: remove repeating row entries in gridExtra table

Problem:
I create a table using the gridExtra package:
require("gridExtra")
# Prepare data frame
col1 = c(rep("A", 3), rep("B", 2), rep("C", 5))
col2 = c(rep("1", 4), rep("2", 3), rep("3", 3))
col3 = c(1:10)
df = data.frame(col1, col2, col3)
# Create table
grid.arrange(tableGrob(df, show.rownames=F))
The output looks like:

Question:
I would like to get rid of the repeating row entries and achieve spanning
entries which like like this:

Any ideas how to achieve this?

No comments:

Post a Comment