Skip to content

Instantly share code, notes, and snippets.

@xiaodaigh xiaodaigh/server.R
Created Sep 20, 2013

Embed
What would you like to do?
Beginner help on input and plotting
library(shiny)
#tu<-read.csv(file="tu.csv", header = TRUE, sep = ",")
#attach(tu)
tu <- data.frame(id=rnorm(1000),size=rnorm(1000),months=rnorm(1000))
shinyServer(function(input, output) {
it<- reactive({
print(input$tu)
switch(input$tu,
"id" = tu$id,
"size" = tu$size,
"months" = tu$months)
})
output$distplot<- renderPlot({ hist(it())
})
})
shinyUI(pageWithSidebar(
headerPanel("statistics"),
sidebarPanel(
selectInput("tu", "Variable:", list("id"="id","size"="size","months"="months")))
, mainPanel(
plotOutput("distplot")
)
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.