Skip to content

Commit

Permalink
Flushed out markdown with shiny
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredlander committed May 2, 2018
1 parent bf2ec52 commit d99a5b7
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions markdown/ShinyWithMarkdown.Rmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
title: Shiny in Markdown
author: The Yankees
date: May 2, 2018
output: html_document
runtime: shiny
---

# Select Input

```{r select-input}
selectInput(
inputId='StateSelection',
label='Please choose a state',
choices=list('NY', 'NJ', 'MA', 'RI', 'TX'),
selected='MA'
)
```

```{r print-state}
renderText(input$StateSelection)
```

# Other Inputs

```{r other-inputs}
sliderInput(
inputId='SliderSample',
label='This is a slider',
min=0, max=10, value=5
)
checkboxInput(
inputId='CheckSample',
label='Check This'
)
radioButtons(
inputId='RadioSample',
label='Choose one',
choices=list('AB', 'A', 'B', 'O')
)
dateInput(
inputId='DateChoice',
label='Select a date'
)
dateRangeInput(
inputId='DateRangeChoice',
label='Choose your dates'
)
```

# Text Input

```{r text-inputs}
textInput(
inputId='TextSample',
label='Write something',
placeholder='Write on the ghost'
)
textAreaInput(
inputId='TextAreaSample',
label='Write a long passage'
)
passwordInput(
inputId='PasswordSample',
label='Enter the secret'
)
renderText(input$PasswordSample)
```

# Show Data

```{r render-tables}
renderTable(mtcars)
renderDataTable(mtcars)
DT::renderDataTable(mtcars)
```

# Plots

```{r render-plot}
renderPlot(hist(mtcars$mpg))
```

```{r render-choices}
selectInput(
inputId='PlotColumn',
label='Choose a column',
choices=names(mtcars)
)
sliderInput(
inputId='Bins',
label='Choose number of bins',
min=5, max=50, value=30
)
```

```{r gg-hist}
library(ggplot2)
renderPlot(
ggplot(mtcars, aes_string(x=input$PlotColumn)) +
geom_histogram(bins=input$Bins)
)
```

```{r render-plotly}
plotly::renderPlotly(
plotly::ggplotly(
ggplot(mtcars,
aes_string(x=input$PlotColumn)
) +
geom_histogram(bins=input$Bins)
)
)
```

0 comments on commit d99a5b7

Please sign in to comment.