library(shiny)
shinyServer(function(input, output) {
output$rawStats <- renderPrint({
x <- exposure_misc(input$ep_op, input$en_op, input$ep_on, input$en_on,
input$se_p, input$se_n, input$sp_p, input$sp_n,
verbose = TRUE)
print(x)
})
output$standardContingency <- renderTable({
ex_cor <- exposure_misc(input$ep_op, input$en_op, input$ep_on, input$en_on,
input$se_p, input$se_n, input$sp_p, input$sp_n,
verbose = TRUE)
return(ex_cor$standard_contingency)
}, digits = 0)
output$correctedContingency <- renderTable({
ex_cor <- exposure_misc(input$ep_op, input$en_op, input$ep_on, input$en_on,
input$se_p, input$se_n, input$sp_p, input$sp_n,
verbose = TRUE)
return(ex_cor$corrected_contingency)
}, digits = 0)
output$ratios <- renderTable({
ex_cor <- exposure_misc(input$ep_op, input$en_op, input$ep_on, input$en_on,
input$se_p, input$se_n, input$sp_p, input$sp_n,
verbose = TRUE)
ratios <- matrix(rep(0,6), nrow=2)
attr(ratios, "dimnames") <- list(c("RR", "OR"), c("Standard", "Corrected", "Ratios"))
ratios[1,1] <- ex_cor$rr
ratios[1,2] <- ex_cor$rr_c
ratios[1,3] <- ex_cor$rr / ex_cor$rr_c
ratios[2,1] <- ex_cor$or
ratios[2,2] <- ex_cor$or_c
ratios[2,3] <- ex_cor$or / ex_cor$or_c
return(as.table(ratios))
})
output$sc_plot <- renderPlot({
ex_cor <- exposure_misc(input$ep_op, input$en_op, input$ep_on, input$en_on,
input$se_p, input$se_n, input$sp_p, input$sp_n,
verbose = TRUE)
mosaic(ex_cor$standard_contingency[1:2,1:2],
shade = TRUE)
})
output$cc_plot <- renderPlot({
ex_cor <- exposure_misc(input$ep_op, input$en_op, input$ep_on, input$en_on,
input$se_p, input$se_n, input$sp_p, input$sp_n,
verbose = TRUE)
mosaic(ex_cor$corrected_contingency[1:2,1:2],
shade = TRUE)
})
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.