IVI*_*VIM 3 r r-markdown shiny
我开发的函数取自inputShiny。然而,为了测试这些功能,我需要在没有 Shiny 的情况下运行它们。所以我想做这样的事情。
---
title: "My report that prints `input` variable in both reactive and static format"
# runtime: shiny # I want to be able programmatically to see when Shiny is running and when NOT
---
```{r}
library(shiny)
input0 <- list()
input0$typedDate <- "6/08/1935"
if (!is.shinyRunning()) {
print("Shiny is Not Running")
input <- input0
} else {
textInput("typedDate", "Enter Date:", "6 jul 1935")
}
renderPrint(input$typedDate)
Run Code Online (Sandbox Code Playgroud)
请注意,我尝试使用if (interactive()),但对于带有 Shiny 和不带有 Shiny 的报告,它都会返回 FALSE。