Consider this example
library(gridExtra)
library(grid)
d1 <- head(iris[,1:3]) %>% as_tibble()
d2 <- head(iris[,2:5]) %>% as_tibble()
grid.arrange(tableGrob(d1),
tableGrob(d2))
which gives
This is really nice but I am missing the titles of the dataframes! How can I add them to the picture automatically?
Thanks!
You can use ggplot
,
library(ggplot2)
dd1 <- ggplot() + annotation_custom(tableGrob(d1)) + labs(title = 'd1')
dd2 <- ggplot() + annotation_custom(tableGrob(d2)) + labs(title = 'd2')
grid.arrange(dd1, dd2, nrow = 2)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With