Skip to content

Commit

Permalink
Create shiny.qmd
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecilsingh authored Dec 23, 2024
1 parent 6d4112c commit 256f252
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions quarto/shiny.qmd
Original file line number Diff line number Diff line change
@@ -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 <https://quarto.org/docs/interactive/shiny/>.

## 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')
})
```

0 comments on commit 256f252

Please sign in to comment.