Albert Y. Kim
Friday 2016/3/25
Today we will create interactive web applications via Shiny. Shiny allows you to do so without knowing HTML, JavaScript, CSS, etc…
For the rest of this talk, if you see USERNAME, replace this with your
Middlebury login.
There are many ways to create a Shiny App
app.Rui.R/server.R…but they all share certain components. We focus on the 2nd.
UI user interface component: what the user sees
Panel: organize the layoutSOMETHINGInput: App takes inputs and saves them in input. Ex: text, numerical values, sliders, radio buttons, etc.renderSOMETHING: Shiny renders an output. Ex: plots, table, text, etc.server: the R code that does the work behind the scenesThen run it!
Let's create a new single file Shiny app app.R:
testing and “single file” application type.sliderInput() assign a value to bins based on a slider?selectInput, for example, to get a sense for the arguments.plotOutput("distPlot") renders the output defined in the server section. The server section does the outputTo publish your apps:
Mac:
cifs://shiny.middlebury.edu/USERNAMEWindows:
\\shiny.middlebury.edu\USERNAMEOnce logged in:
ShinyAppsThe URL any Shiny App APPNAME is
For now, this is only way I know; I'm investigating if this can be easier.
ssh USERNAME@shiny.middlebury.eduR.install.packages("ggplot2") for exampleFirst
testing folder into the ShinyApps folder on the serverSecond
app.R file to be a ggplot, but keep the slider
so that it sets the bins argument in geom_histogram().ggplot2 and dplyr on Shiny Server.app.R to be the new app.shiny_slides.pdf in Lec16 Shiny folder.