Open p0bs opened 8 months ago
Apologies, the main repo documentation is a little out of date. This Quarto extension should now also support adding R Shiny apps in a Quarto document, using something like the following snippet in your Quarto source:
```{shinylive-r}
#| viewerHeight: 600
#| standalone: true
library(shiny)
library(datasets)
mpgData <- mtcars
mpgData$am <- factor(mpgData$am, labels = c("Automatic", "Manual"))
ui <- fluidPage(
titlePanel("Miles Per Gallon"),
sidebarLayout(
sidebarPanel(
selectInput("variable", "Variable:",
c("Cylinders" = "cyl",
"Transmission" = "am",
"Gears" = "gear")),
checkboxInput("outliers", "Show outliers", TRUE)
),
mainPanel(
h3(textOutput("caption")),
plotOutput("mpgPlot")
)
)
)
server <- function(input, output) {
formulaText <- reactive({
paste("mpg ~", input$variable)
})
output$caption <- renderText({
formulaText()
})
output$mpgPlot <- renderPlot({
boxplot(as.formula(formulaText()),
data = mpgData,
outline = input$outliers,
col = "#75AADB", pch = 19)
})
}
shinyApp(ui, server)
Belated thanks for this, George.
With this, I'm looking forward to being able to create a blog post on my Netlify site that can contain its brief spiel and a shinylive app (which imports the relevant data from, say, https://github.com/p0bs/.../raw/.../data.rds).
I sense that the only missing part is my understanding of how all the pieces fit together (which is up to me to solve, given the good documentation already in place)!
Many thanks again.
Apologies if this has been answered elsewhere, but I've looked around and haven't seen it.
In the About section of this repo, you state that it is a "Quarto extension to embed Shinylive for Python applications".
Whilst I've seen quarto-webr (A "Quarto Extension to Embed webR" into associated Quarto goodness) and r-shinylive ("An R package for exporting Shiny applications as Shinylive applications"), are there any plans to create the R equivalent of this repo (i.e. a "Quarto extension to embed Shinylive for R applications")? Or am I just missing something obvious?
Thank you for all your terrific work in this area.