From 256f252b7704b1793c980cb77ad18dce1c854787 Mon Sep 17 00:00:00 2001 From: Cecil Singh <54638818+Cecilsingh@users.noreply.github.com> Date: Mon, 23 Dec 2024 11:48:35 +1100 Subject: [PATCH] Create shiny.qmd --- quarto/shiny.qmd | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 quarto/shiny.qmd diff --git a/quarto/shiny.qmd b/quarto/shiny.qmd new file mode 100644 index 0000000..bd51b12 --- /dev/null +++ b/quarto/shiny.qmd @@ -0,0 +1,30 @@ +--- +title: "Number of Bins" +format: html +server: shiny +--- + +## Shiny Documents + +This Quarto document is made interactive using Shiny. Interactive documents allow readers to modify parameters and see the results immediately. Learn more about Shiny interactive documents at . + +## Inputs and Outputs + +You can embed Shiny inputs and outputs in your document. Outputs are automatically updated whenever inputs change. This demonstrates how a standard R plot can be made interactive: + +```{r} +sliderInput("bins", "Number of bins:", + min = 1, max = 50, value = 30) +plotOutput("distPlot") +``` + +```{r} +#| context: server +output$distPlot <- renderPlot({ + x <- faithful[, 2] # Old Faithful Geyser data + bins <- seq(min(x), max(x), length.out = input$bins + 1) + hist(x, breaks = bins, col = 'darkgray', border = 'white', + xlab = 'Waiting time to next eruption (in mins)', + main = 'Histogram of waiting times') +}) +```