Conditinal execution of chunks in markdown file


currently I am trying to find a solution for executing chunks if the value(column name in table) from a textInput references to a numerical column in a given dataset.
I would like to check, if data[input$variable] is numerical. If True, the chunk should be executed.

I am using chunks in R Markdown and try to get an interactive shiny document.

thank you

Hi @gauss193,

R Markdown chunk options are evaluated as R code, so you can add conditional flows directly in the options to determine whether a chunk is executed depending on whether the statement evaluates to TRUE or FALSE.

```{r eval=is.numeric(data[input$variable])}
# some code to possibly evaluate...


thank you for the quick answer. Unfortunately I already tried this, but I still get the error:
"Can't access reactive value "variable" outside of reactive consumer."

Hope, someone already had the same issue and can provide me a solution for this.

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.