Conditional evaluation of pieces within Rmarkdown

Hi all, a bit new here.

Is it possible to have a conditional evaluation of RMarkdown so that a single document could be both rendered as PDF as well as a Shiny app?

(for example, if a table provides input into a plot, the initial table contents would be used in the PDF, but the table could be edited to create different plots in the RMarkdown document).

I know I can write a preprocessor for a domain-specific language to generate both variants, but it would be great if such a conditional syntax (or even such a preprocessor) already existed, and I was just a clueless newbie.

best,
Tony

Are you talking about conditional evaluation of chunks ?

Here is an example of a Rmd content to output differently in HTML and LATEX, and code evaluation is conditionnal to the output format at rendering

As you can make chunk conditonnal to any variables, you can even make some markdown content conditional

Does it helps to what you are looking for ? I am not sure if I understood correcly your need

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.