I am new to rmarkdown and I would like to show a plot which is normally produced in a new window. This plot is called from a function that displays it in a new window using plot.new() and dev.new() and also adds several plots in that window. How can I return this to the report?
the following does not return the plots...
```{r fig.keep='all', fig.width=10, fig.height=5}
Draw_matrix_plots(data)
```
and the function skeleton I am calling which draws four plots in a new window:
Draw_matrix_plots <- function(data){
plot.new()
dev.new(width=7, height=8)
layout(matrix(c(1,2,3,4), 2, 2, byrow = TRUE),heights=c(3,3))
hist(data$A)
hist(data$B)
hist(data$C)
hist(data$D)
}
Thanks