flexdashboard
flexdashboard copied to clipboard
Scroll multiple graphs in one R chunk
I am trying to create a flexdashboard with one tab including multiple graphs (~50). What i get as an output is showing only some graphs and not all. The functionality of scroll is deactivated. I have tried to change the vertical layout = scroll but this does not work either. This seem to be related to the fact that all graphs are written in one chunk as produced by an in-chunk loop. Any ideas? Thanks
Can you separate each graph into its own chunk? You can achieve that with the knit_child() function to knit child documents inside the parent Rmd. See here: https://yihui.name/knitr/demo/child/
Thanks @bborgesr But the problem here is that number of graphs is unknown as it varies each time and that's why they're produced in a loop.
I see, you need to be able to create the chunks programmatically. I think these other resources will help you achieve that:
- https://stackoverflow.com/a/14368148/6174455
- http://rstudio-pubs-static.s3.amazonaws.com/1283_a009514e3eb24680b1ba0d4d291c2546.html
- https://github.com/yihui/knitr/blob/master/vignettes/knit_expand.Rmd
Good luck!