Last active
August 29, 2015 14:05
-
-
Save lgatto/49f0effd0873e0678be6 to your computer and use it in GitHub Desktop.
Inline and external apps in Rmd
This file contains hidden or 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: " Embedded Shiny Apps" | |
| runtime: shiny | |
| output: | |
| html_document: | |
| theme: united | |
| --- | |
| ## Setup | |
| ```{r} | |
| library("rmarkdown") | |
| library("shiny") | |
| packageVersion("shiny") | |
| packageVersion("rmarkdown") | |
| ``` | |
| Pandoc version 1.12.4.2. | |
| ## Compile vignette | |
| ```{r, eval=FALSE} | |
| rmarkdown::run("test.Rmd") | |
| ``` | |
| ## Inline App | |
| ```{r, echo = FALSE} | |
| shinyApp( | |
| ui = fluidPage( | |
| selectInput("region", "Region:", | |
| choices = colnames(WorldPhones)), | |
| plotOutput("phonePlot") | |
| ), | |
| server = function(input, output) { | |
| output$phonePlot <- renderPlot({ | |
| barplot(WorldPhones[,input$region]*1000, | |
| ylab = "Number of Telephones", xlab = "Year") | |
| }) | |
| }, | |
| options = list(height = 500) | |
| ) | |
| ``` | |
| ## External App | |
| ```{r, echo = FALSE} | |
| shinyAppDir( | |
| system.file("examples/06_tabsets", package="shiny"), | |
| options=list( | |
| width="100%", height=700 | |
| ) | |
| ) | |
| ``` | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment