'Grid.table: export multiple tables into one pdf

I am trying to display multiple tables using grid.table and export them in a pdf, but it only shows the first table. Why?

tbl <- matrix(1:100,nrow=10)

tbl2 <- matrix(100:1,nrow=10)

require("gridExtra")

pdf("test.pdf")
grid.table(tbl)
grid.table(tbl2)

dev.off()


Solution 1:[1]

You can also use plot.new. You can use the following code:

tbl <- matrix(1:100,nrow=10)

tbl2 <- matrix(100:1,nrow=10)

require("gridExtra")

pdf("test.pdf")
grid.table(tbl)
plot.new()
grid.table(tbl2)
dev.off()

Output:

enter image description here

As you can see, the second plot is shown on the second page.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Quinten