Hi,
I was wondering if anyone knew of a way to have the R code of a RMarkdown document changed by whether the document is being knitted to PDF vs HTML
Specifically, I have a document that I would like to knit to both, depending on the user. For the html_document, I would like to wrap many of my ggplots with plotly::ggplotly()
to make them interactive. However, this does not work for the pdf_document, so I am fine just using the static version. Is there a way I can have the engine itself choose which version it outputs?
Currently, my workaround is to have a indicator at the top that I manually change about which it is (and then plots are wrapped in an ifelse()
, but sometimes I forget to change it.
Thanks