learnr package functionality inside shiny application or vice versa

Is it possible to use shiny apps inside Rmd file with runtime: shiny_prerendered option as required by learnr tutorials

Tried this Rmd file, but this results in a static shiny app.

PS: Remove the forward-slash from code chunks to run this from an Rmd file. Made that to post the whole code here.

---
title: "Hello,  Quiz Time!"
output: learnr::tutorial
runtime: shiny_prerendered
---

/```{r setup, include=FALSE}
library(learnr)
/```


/```{r letter-a, echo=FALSE}
question("What number is the letter A in the English alphabet?",
  answer("8"),
  answer("14"),
  answer("1", correct = TRUE),
  answer("23")
)
/```

/```{r shiny-app, echo=FALSE}
library(shiny)
shinyApp(

  ui = fluidPage(
    selectInput("region", "Region:",
                choices = colnames(WorldPhones)),
    plotOutput("phonePlot")
  ),

  server = function(input, output) {
    output$phonePlot = renderPlot({
      barplot(WorldPhones[,input$region]*1000,
              ylab = "Number of Telephones", xlab = "Year")
    })
  },

  options = list(height = 500)
)
/```

Or if other way possible? Like running Rmd file with learnr tutorials settings (runtime: shiny_prerendered) from inside a shiny app.

Okay, shiny components can be used in learnr tutorials but sight differently. Found this - https://bookdown.org/yihui/rmarkdown/learnr-shiny.html

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