Created
September 20, 2013 02:20
-
-
Save xiaodaigh/6632557 to your computer and use it in GitHub Desktop.
Beginner help on input and plotting
This file contains 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
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()) | |
}) | |
}) |
This file contains 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
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