Created
July 14, 2017 16:06
-
-
Save stephlocke/4454adb4458f3ffe8ff5f47312238c53 to your computer and use it in GitHub Desktop.
A quick app built showing how to make sliders and interactive charts!
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
--- | |
title: "Untitled" | |
output: | |
flexdashboard::flex_dashboard: | |
orientation: columns | |
vertical_layout: fill | |
runtime: shiny | |
--- | |
```{r setup, include=FALSE} | |
library(flexdashboard) | |
library(ggplot2) | |
library(plotly) | |
library(tidyverse) | |
``` | |
Column {.sidebar} | |
----------------------------------------------------------------------- | |
```{r} | |
sliderInput("rows","Iris rows to select",min = 0, max = nrow(iris), nrow(iris)) | |
checkboxGroupInput("species", | |
"Within the following species", | |
unique(iris$Species), | |
unique(iris$Species)) | |
``` | |
Column {data-width=650} | |
----------------------------------------------------------------------- | |
### Chart A | |
```{r} | |
renderPlotly({ | |
iris %>% | |
sample_n(input$rows) %>% | |
filter(Species %in% input$species) %>% | |
ggplot(aes(Petal.Length, Petal.Width, colour=Species)) + | |
geom_point() -> | |
basicChart | |
plotly::ggplotly(basicChart) | |
}) | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment