Skip to content

Instantly share code, notes, and snippets.

@jeffreyhorner
Created December 4, 2012 18:45
Show Gist options
  • Save jeffreyhorner/4207364 to your computer and use it in GitHub Desktop.
Save jeffreyhorner/4207364 to your computer and use it in GitHub Desktop.
simpleTab
library(shiny)
shinyServer(function(input, output) {
cat('shinyServer called\n',file=stderr())
output$foo <- reactivePrint(function(){
cat('output$foo called\n',file=stderr())
input$n
})
output$afunc <- reactivePrint(function() {
cat('output$summary called\n',file=stderr())
Sys.sleep(4)
input$n
})
output$bfunc <- reactivePrint(function() {
cat('output$table called\n',file=stderr())
input$n
})
output$plot <- reactivePlot(function(){
cat('output$plot called\n',file=stderr())
plot(rnorm(input$n))
})
})
library(shiny)
shinyUI(pageWithSidebar(
# Application title
headerPanel("Tabsets"),
sidebarPanel(
sliderInput("n",
"Number of observations:",
value = 500,
min = 1,
max = 1000)
),
mainPanel(
tabsetPanel(
tabPanel("A", verbatimTextOutput("afunc")),
tabPanel("B", verbatimTextOutput("bfunc")),
tabPanel("Plot",plotOutput('plot'))
)
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment