diff --git a/R/bar.R b/R/bar.R index e2786cca..516a16e4 100644 --- a/R/bar.R +++ b/R/bar.R @@ -188,14 +188,14 @@ barServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit tglist <- tagList() if (vlist()$nclass_factor[input$x_bar] < 3) { - pval.choices <- c("T-test"="t.test", "Wilcoxon"="wilcox.test") + pval.choices <- c("T-test" = "t.test", "Wilcoxon" = "wilcox.test") } else { - pval.choices <- c("ANOVA"="anova", "Kruskal-Wallis"="kruskal.test") + pval.choices <- c("ANOVA" = "anova", "Kruskal-Wallis" = "kruskal.test") } tglist <- tagAppendChildren( tglist, - div("P value Option") %>% strong, + div("P value Option") %>% strong(), tabsetPanel( id = session$ns("side_tabset_pval"), type = "hidden", @@ -250,7 +250,7 @@ barServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit session$ns("p_pvalue"), label = NULL, inline = TRUE, - choices = c("T-test"="t_test", "Wilcoxon"="wilcox_test") + choices = c("T-test" = "t_test", "Wilcoxon" = "wilcox_test") ), ), tabPanel( @@ -281,7 +281,7 @@ barServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit session$ns("s_pvalue"), label = NULL, inline = TRUE, - choices = c("T-test"="t_test", "Wilcoxon"="wilcox_test") + choices = c("T-test" = "t_test", "Wilcoxon" = "wilcox_test") ) ), tabPanel( @@ -297,21 +297,25 @@ barServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit # Error message popup barInputError <- reactive({ - msg <- tryCatch({ - print(barInput() %>% suppressWarnings) - }, warning = function(e) { - res <- e - temp <- e - while(!is.null(temp$message)) { - res <- temp - temp <- temp$parent + msg <- tryCatch( + { + print(barInput() %>% suppressWarnings()) + }, + warning = function(e) { + res <- e + temp <- e + while (!is.null(temp$message)) { + res <- temp + temp <- temp$parent + } + return(res$message) + }, + error = function(e) { + return(e$message) } - return(res$message) - }, error = function(e) { - return(e$message) - }) + ) - ifelse (!is.ggplot(msg), msg, "Success") + ifelse(!is.ggplot(msg), msg, "Success") }) @@ -480,11 +484,11 @@ barServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit } if (is.null(input$pvalfont)) { - pval.font.size <- c(4, 4, 0.4) - pval.coord <- c(0.5, 1) + pval.font.size <- c(4, 4, 0.4) + pval.coord <- c(0.5, 1) } else { - pval.font.size = c(input$pvalfont, input$p_pvalfont, input$p_pvalfont / 10) - pval.coord = c(input$pvalx, input$pvaly) + pval.font.size <- c(input$pvalfont, input$p_pvalfont, input$p_pvalfont / 10) + pval.coord <- c(input$pvalx, input$pvaly) } pval.name <- input$pvalue @@ -603,14 +607,18 @@ barServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit tagList( h3("P-value position"), sliderInput(session$ns("pvalfont"), "P-value font size", - min = 1, max = 10, value = 4), + min = 1, max = 10, value = 4 + ), sliderInput(session$ns("pvalx"), "x-axis", - min = 0, max = 1, value = 0.5), + min = 0, max = 1, value = 0.5 + ), sliderInput(session$ns("pvaly"), "y-axis", - min = 0, max = 1, value = 1), + min = 0, max = 1, value = 1 + ), h3("Pair P-value position"), sliderInput(session$ns("p_pvalfont"), "P-value font size", - min = 1, max = 10, value = 4), + min = 1, max = 10, value = 4 + ), actionButton(session$ns("pval_reset"), "reset"), ) }) diff --git a/R/box.R b/R/box.R index b38c30c8..ba8fcaf6 100644 --- a/R/box.R +++ b/R/box.R @@ -187,14 +187,14 @@ boxServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit tglist <- tagList() if (vlist()$nclass_factor[input$x_box] < 3) { - pval.choices <- c("T-test"="t.test", "Wilcoxon"="wilcox.test") + pval.choices <- c("T-test" = "t.test", "Wilcoxon" = "wilcox.test") } else { - pval.choices <- c("ANOVA"="anova", "Kruskal-Wallis"="kruskal.test") + pval.choices <- c("ANOVA" = "anova", "Kruskal-Wallis" = "kruskal.test") } tglist <- tagAppendChildren( tglist, - div("P value Option") %>% strong, + div("P value Option") %>% strong(), tabsetPanel( id = session$ns("side_tabset_pval"), type = "hidden", @@ -249,7 +249,7 @@ boxServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit session$ns("p_pvalue"), label = NULL, inline = TRUE, - choices = c("T-test"="t_test", "Wilcoxon"="wilcox_test") + choices = c("T-test" = "t_test", "Wilcoxon" = "wilcox_test") ), ), tabPanel( @@ -280,7 +280,7 @@ boxServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit session$ns("s_pvalue"), label = NULL, inline = TRUE, - choices = c("T-test"="t_test", "Wilcoxon"="wilcox_test") + choices = c("T-test" = "t_test", "Wilcoxon" = "wilcox_test") ) ), tabPanel( @@ -296,21 +296,25 @@ boxServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit # Error message popup boxInputError <- reactive({ - msg <- tryCatch({ - print(boxInput() %>% suppressWarnings) - }, warning = function(e) { - res <- e - temp <- e - while(!is.null(temp$message)) { - res <- temp - temp <- temp$parent + msg <- tryCatch( + { + print(boxInput() %>% suppressWarnings()) + }, + warning = function(e) { + res <- e + temp <- e + while (!is.null(temp$message)) { + res <- temp + temp <- temp$parent + } + return(res$message) + }, + error = function(e) { + return(e$message) } - return(res$message) - }, error = function(e) { - return(e$message) - }) + ) - ifelse (!is.ggplot(msg), msg, "Success") + ifelse(!is.ggplot(msg), msg, "Success") }) @@ -472,11 +476,11 @@ boxServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit fillcolor <- "gray" } if (is.null(input$pvalfont)) { - pval.font.size <- c(4, 4, 0.4) - pval.coord <- c(0.5, 1) + pval.font.size <- c(4, 4, 0.4) + pval.coord <- c(0.5, 1) } else { - pval.font.size = c(input$pvalfont, input$p_pvalfont, input$p_pvalfont / 10) - pval.coord = c(input$pvalx, input$pvaly) + pval.font.size <- c(input$pvalfont, input$p_pvalfont, input$p_pvalfont / 10) + pval.coord <- c(input$pvalx, input$pvaly) } pval.name <- input$pvalue ppval.name <- input$p_pvalue @@ -594,14 +598,18 @@ boxServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limit tagList( h3("P-value position"), sliderInput(session$ns("pvalfont"), "P-value font size", - min = 1, max = 10, value = 4), + min = 1, max = 10, value = 4 + ), sliderInput(session$ns("pvalx"), "x-axis", - min = 0, max = 1, value = 0.5), + min = 0, max = 1, value = 0.5 + ), sliderInput(session$ns("pvaly"), "y-axis", - min = 0, max = 1, value = 1), + min = 0, max = 1, value = 1 + ), h3("Pair P-value position"), sliderInput(session$ns("p_pvalfont"), "P-value font size", - min = 1, max = 10, value = 4), + min = 1, max = 10, value = 4 + ), actionButton(session$ns("pval_reset"), "reset"), ) }) diff --git a/R/line.R b/R/line.R index d64f97cb..2b7b347b 100644 --- a/R/line.R +++ b/R/line.R @@ -190,17 +190,17 @@ lineServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limi tglist <- tagList() if (input$strata != "None") { if (vlist()$nclass_factor[input$strata] < 3) { - pval.choices <- c("T-test"="t.test", "Wilcoxon"="wilcox.test") + pval.choices <- c("T-test" = "t.test", "Wilcoxon" = "wilcox.test") } else { - pval.choices <- c("ANOVA"="anova", "Kruskal-Wallis"="kruskal.test") + pval.choices <- c("ANOVA" = "anova", "Kruskal-Wallis" = "kruskal.test") } } else { - pval.choices <- c("ANOVA"="anova", "Kruskal-Wallis"="kruskal.test") + pval.choices <- c("ANOVA" = "anova", "Kruskal-Wallis" = "kruskal.test") } tglist <- tagAppendChildren( tglist, - div("P value Option") %>% strong, + div("P value Option") %>% strong(), tabsetPanel( id = session$ns("side_tabset_isstrata"), type = "hidden", @@ -239,21 +239,25 @@ lineServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limi lineInputError <- reactive({ - msg <- tryCatch({ - print(lineInput() %>% suppressWarnings) - }, warning = function(e) { - res <- e - temp <- e - while(!is.null(temp$message)) { - res <- temp - temp <- temp$parent + msg <- tryCatch( + { + print(lineInput() %>% suppressWarnings()) + }, + warning = function(e) { + res <- e + temp <- e + while (!is.null(temp$message)) { + res <- temp + temp <- temp$parent + } + return(res$message) + }, + error = function(e) { + return(e$message) } - return(res$message) - }, error = function(e) { - return(e$message) - }) + ) - ifelse (!is.ggplot(msg), msg, "Success") + ifelse(!is.ggplot(msg), msg, "Success") }) @@ -396,9 +400,9 @@ lineServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limi } if (is.null(input$pvalfont)) { - pval.font.size <- 4 + pval.font.size <- 4 } else { - pval.font.size = input$pvalfont + pval.font.size <- input$pvalfont } spval.name <- input$s_pvalue @@ -503,7 +507,8 @@ lineServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limi sliderInput(session$ns("positiondodge"), "Position dodge", min = 0, max = 1, value = 0), h3("P-value position"), sliderInput(session$ns("pvalfont"), "P-value font size", - min = 1, max = 10, value = 4), + min = 1, max = 10, value = 4 + ), actionButton(session$ns("pval_reset"), "reset") ) })