I would like to conditionally print out text in a Rmarkdown notebook I am writing to automate a report for a project. I have found an answer to conditionally print out text in the rmarkdown notebook using the the code below:
`r if(show.text){"la la la"}`
Which would print out inline, "la la la" if the show.text object is true. What I would like to know is how to use functions within the brackets, for example:
`r if(show.text){print(x)}`
The code above does not work. I would like to be able to combine this to make a more complicated conditional
`r if(show.text){"la la la" print(x) "bi bi bi" if(y)"bla bla bla"}`
But this does not work. Can anyone help me or tell me if this is possible? Thanks!