server = function(input, output, session) {
t <- reactive({ signif(seq(input$range.sget[1], input$range.sget[2],length = 500), digits = 4) })
p <- reactive({ signif(seq(0, 1, length = 500), digits = 4) })
C <- reactive({ pgets(t(),input$al.sgets,input$si.sgets,input$xi.sgets,distribution = "sev") })
P <- reactive({ dgets(t(),input$al.sgets,input$si.sgets,input$xi.sgets,distribution = "sev")})
R <- reactive({ 1-C()})
h <- reactive({exp(log(P())-log(R()))})
H <- reactive({ -1*log(1-pgets(t(),input$al.sgets,input$si.sgets,input$xi.sgets,distribution = "sev"))})
Q <- reactive({ qgets(p(),input$al.sgets,input$si.sgets,input$xi.sgets,distribution = "sev")})
df <- reactive({data.frame(Time = t(),PROB = p(), CDF = C(),PDF = P(),REL = R(),haz = h(),HAZ = H(), QUANT = Q())})
output$sgetC <- renderMetricsgraphics({
mjs_plot(df(), x = Time, y = CDF, decimals = 4, top = 0) %>%
mjs_line(area = TRUE) %>%
mjs_labs(x_label = 'Time (t)', y_label = 'F(t)')%>%
mjs_add_css_rule("{{ID}} .mg-active-datapoint { font-size: 20pt }")})
output$sgetP <- renderMetricsgraphics({
mjs_plot(df(), x = Time, y = PDF, decimals = 4) %>%
mjs_line(area = TRUE) %>%
mjs_labs(x_label = 'Time (t)', y_label = 'f(t)') %>%
mjs_add_css_rule("{{ID}} .mg-active-datapoint { font-size: 20pt }")})
output$sgetR <- renderMetricsgraphics({
mjs_plot(df(), x = Time, y = REL, decimals = 4) %>%
mjs_line(area = TRUE) %>%
mjs_labs(x_label = 'Time (t)', y_label = 'S(t)') %>%
mjs_add_css_rule("{{ID}} .mg-active-datapoint { font-size: 20pt }")})
output$sgeth <- renderMetricsgraphics({
mjs_plot(df(), x = Time, y = haz, decimals = 4) %>%
mjs_line(area = TRUE) %>%
mjs_labs(x_label = 'Time (t)', y_label = 'h(t)') %>%
mjs_add_css_rule("{{ID}} .mg-active-datapoint { font-size: 20pt }")})
output$sgetH <- renderMetricsgraphics({
mjs_plot(df(), x = Time, y = HAZ, decimals = 4) %>%
mjs_line(area = TRUE) %>%
mjs_labs(x_label = 'Time (t)', y_label = 'H(t)') %>%
mjs_add_css_rule("{{ID}} .mg-active-datapoint { font-size: 20pt }")})
output$sgetQ <- renderMetricsgraphics({
mjs_plot(df(), x = PROB, y = QUANT, decimals = 4) %>%
mjs_line(area = TRUE) %>%
mjs_labs(x_label = 'Probability (p)', y_label = 't(p)') %>%
mjs_add_css_rule("{{ID}} .mg-active-datapoint { font-size: 20pt }")})
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.