Skip to content

Instantly share code, notes, and snippets.

@ashutoshnanda
Created March 7, 2016 23:56
Show Gist options
  • Save ashutoshnanda/af5b547994ab967c0ac4 to your computer and use it in GitHub Desktop.
Save ashutoshnanda/af5b547994ab967c0ac4 to your computer and use it in GitHub Desktop.
DataSpace Code for March 7th, 2016 - Shiny!!
shinyServer(function(input, output) {
output$selectvalue <- renderPrint(
3 * as.numeric(input$myselectinput) + 5
)
output$slidervalue <- renderPrint(
input$mysliderinput * as.numeric(input$myselectinput)
)
output$plot <- renderPlot(
hist(rnorm(100, mean = input$mysliderinput))
)
})
#For publishing online: http://shiny.rstudio.com/articles/shinyapps.html
shinyUI(fluidPage(
titlePanel("My Shiny App Here"),
sidebarLayout(
sidebarPanel(
h3("Sidebar"),
#http://shiny.rstudio.com/tutorial/lesson3/
selectInput("myselectinput",
label = "Pick A Value",
choices = c("First" = 1,
"Second" = 2,
"Third" = 3)),
sliderInput("mysliderinput",
label = "Slide me!",
min = 0,
max = 10,
value = 3, #c(5, 7)
step = 0.1)
),
mainPanel(
h3("Main"),
textOutput("selectvalue"),
textOutput("slidervalue"),
plotOutput("plot")
)
)
#h1("My Title"),
#hr(),
#em("italicize me"),
#br(),
#strong("bold me")
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment