-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
6d4112c
commit 256f252
Showing
1 changed file
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}) | ||
``` |