0

Is there a way to display a table and a chart in Rmarkdown? I am trying export the such report to Word and excel not to pdf.

1 Answers1

0

Word is tough. I would recommend pdf or html, but if you have to use word then you can combine the plot and table into a single image using gridExtra

library(gridExtra)
library(ggplot2)

data(iris)

myTable = tableGrob(iris[1:10,])
myPlot = ggplot(iris, aes(x = Sepal.Length, y = Sepal.Width)) + geom_point()

grid.arrange(myTable, myPlot, nrow = 1)
Harry Smith
  • 267
  • 1
  • 11
  • Thanks,This approach i tried but facing issues in alignment. I think html can be tried , if you have a better way with html please share. – Sandhya Ghildiyal Jan 20 '21 at 06:21
  • I would check out this [answer](https://stackoverflow.com/questions/54312894/how-to-align-table-and-plot-in-rmarkdown-html-document) and follow the links provided. – Harry Smith Jan 20 '21 at 16:29