Skip to content

Instantly share code, notes, and snippets.

@krishnaiitd
Last active August 21, 2016 14:05
Show Gist options
  • Save krishnaiitd/e8d628d741bde87fd7057642d4b700a8 to your computer and use it in GitHub Desktop.
Save krishnaiitd/e8d628d741bde87fd7057642d4b700a8 to your computer and use it in GitHub Desktop.
diabetesRisk <- function(glucose) glucose / 200
shinyServer(
function(input, output) {
output$inputValue <- renderPrint({input$glucose})
output$prediction <- renderPrint({diabetesRisk(input$glucose)})
}
)
shinyUI(
pageWithSidebar(
# Application title
headerPanel("Diabetes prediction"),
sidebarPanel(
numericInput('glucose', 'Glucose mg/dl', 90, min=50, max=200, step = 5),
submitButton('Submit')
),
mainPanel(
h3('Results of prediction'),
h4('You entered'),
verbatimTextOutput('inputValue'),
h4('Which resulted in a prediction of '),
verbatimTextOutput("prediction")
)
)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment