- # Download table of estimates as a .csv file.
- output$downloadEst <- shiny::downloadHandler(
- filename=function() { paste0("Rnaught-", Sys.Date(), ".csv") },
- content=function(file) { write.csv(reactive$est_table, file) }
- )
-
- shiny::observeEvent(input$addWP, {
- if (input$serialWPKnown == 1) {
- serial <- validate_serial(input, output, "serialWPInput", "serialWPWarn")
- if (!is.na(serial)) {
- reactive$estimators[[length(reactive$estimators)+1]] <- list(method="WP", mu=serial, search=list(B=100, shape.max=10, scale.max=10), mu_units=input$serialWPUnits)
- reactive$est_table <- update_est_col(input, output, reactive$data_table, reactive$estimators[[length(reactive$estimators)]], reactive$est_table)
- }
- }
- else {
- checks_passed <- TRUE
-
- grid_length <- as.numeric(input$gridLengthInput)
- max_shape <- as.numeric(input$gridShapeInput)
- max_scale <- as.numeric(input$gridScaleInput)
-
- if (is.na(grid_length) || grid_length <= 0 || grid_length %% 1 != 0) {
- output$gridLengthWarn <- shiny::renderText("Error: The grid size must be a positive integer.")
- output$gridShapeWarn <- shiny::renderText("")
- output$gridScaleWarn <- shiny::renderText("")
- checks_passed <- FALSE
- }
- else {
- output$gridLengthWarn <- shiny::renderText("")
-
- if (is.na(max_shape) || max_shape < 1 / grid_length) {
- output$gridShapeWarn <- shiny::renderText("Error: The maximum shape must be at least the reciprocal of the grid length.")
- checks_passed <- FALSE
- }
- else
- output$gridShapeWarn <- shiny::renderText("")
-
- if (is.na(max_scale) || max_scale < 1 / grid_length) {
- output$gridShapeWarn <- shiny::renderText("Error: The maximum scale must be at least the reciprocal of the grid length.")
- checks_passed <- FALSE
- }
- else
- output$gridScaleWarn <- shiny::renderText("")
- }
-
- if (checks_passed) {
- reactive$estimators[[length(reactive$estimators)+1]] <- list(method="WP", mu=NA, search=list(B=grid_length, shape.max=max_shape, scale.max=max_scale), mu_units=input$serialWPUnits)
- reactive$est_table <- update_est_col(input, output, reactive$data_table, reactive$estimators[[length(reactive$estimators)]], reactive$est_table)
- }
- }
- })
-
- shiny::observeEvent(input$addseqB, {
- serial <- validate_serial(input, output, "serialseqBInput", "serialseqBWarn")
- checks_passed <- !is.na(serial)
-
- kappa <- as.numeric(input$kappaInput)
- if (is.na(kappa) || kappa <= 0) {
- output$kappaWarn <- shiny::renderText("Error: The maximum value must be a positive number.")
- checks_passed <- FALSE
+ output$dataTable <- shiny::renderDataTable(reactive$data_table,
+ escape = FALSE)
+ output$estTable <- shiny::renderDataTable(reactive$est_table,
+ escape = FALSE)
+
+ # Download table of estimates as a .csv file.
+ output$downloadEst <- shiny::downloadHandler(
+ filename = function() { paste0("Rnaught-", Sys.Date(), ".csv") },
+ content = function(file) { write.csv(reactive$est_table, file) }
+ )
+
+ shiny::observeEvent(input$addWP, {
+ if (input$serialWPKnown == 1) {
+ serial <- validate_serial(input, output, "serialWPInput", "serialWPWarn")
+ if (!is.na(serial)) {
+ reactive$estimators[[length(reactive$estimators) + 1]] <- list(
+ method = "WP", mu = serial, mu_units = input$serialWPUnits,
+ grid_length = 100, max_shape = 10, max_scale = 10)
+ reactive$est_table <- update_est_col(input, output, reactive$data_table,
+ reactive$estimators[[length(reactive$estimators)]],
+ reactive$est_table)
+ }
+ }
+ else {
+ checks_passed <- TRUE
+
+ grid_length <- as.numeric(input$gridLengthInput)
+ max_shape <- as.numeric(input$gridShapeInput)
+ max_scale <- as.numeric(input$gridScaleInput)
+
+ if (is.na(grid_length) || grid_length <= 0 || grid_length %% 1 != 0) {
+ output$gridLengthWarn <- shiny::renderText(
+ "Error: The grid size must be a positive integer.")
+ output$gridShapeWarn <- shiny::renderText("")
+ output$gridScaleWarn <- shiny::renderText("")
+ checks_passed <- FALSE
+ }
+ else {
+ output$gridLengthWarn <- shiny::renderText("")
+
+ if (is.na(max_shape) || max_shape < 1 / grid_length) {
+ output$gridShapeWarn <- shiny::renderText("Error: The maximum shape
+ must be at least the reciprocal of the grid length.")
+ checks_passed <- FALSE