From 3beb4c8d1c6ef1c075c88dcaacb0d5d974fc5feb Mon Sep 17 00:00:00 2001 From: Jinseob Kim Date: Thu, 7 Dec 2023 11:21:07 +0900 Subject: [PATCH] 1.4.4 --- DESCRIPTION | 4 ++-- NAMESPACE | 1 + NEWS.md | 4 ++++ R/line.R | 12 ++++++++++-- 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b604f8d3..4891ccc7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: jsmodule Title: 'RStudio' Addins and 'Shiny' Modules for Medical Research -Version: 1.4.3 -Date: 2023-10-18 +Version: 1.4.4 +Date: 2023-12-07 Authors@R: c(person("Jinseob", "Kim", email = "jinseob2kim@gmail.com", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-9403-605X")), person("Zarathu", role = c("cph", "fnd")), person("Hyunki", "Lee", email = "leevenstar@snu.ac.kr", role = c("aut")), diff --git a/NAMESPACE b/NAMESPACE index 2939fd34..d49b6d3c 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -86,6 +86,7 @@ importFrom(data.table,setkey) importFrom(epiDisplay,tableGlm) importFrom(geepack,geeglm) importFrom(ggplot2,ggsave) +importFrom(ggplot2,scale_y_reverse) importFrom(ggpubr,as_ggplot) importFrom(ggpubr,ggbarplot) importFrom(ggpubr,ggboxplot) diff --git a/NEWS.md b/NEWS.md index a4034fdb..1cdc44b6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# jsmodule 1.4.4 + +## Update: Add "reverse y-axis" option to lineplot + # jsmodule 1.4.3 ## Update `rocModule`: Add accucary/ppv/npv with threshold diff --git a/R/line.R b/R/line.R index 0a98634b..47800375 100644 --- a/R/line.R +++ b/R/line.R @@ -47,6 +47,7 @@ lineUI <- function(id, label = "lineplot") { radioButtons(ns("options"), "Option", choices = c("Mean_SE", "Mean_SD", "Median_IQR"), selected = "Mean_SE", inline = T), checkboxInput(ns("linetype"), "Linetype"), checkboxInput(ns("jitter"), "Jitter"), + checkboxInput(ns("rev_y"), "Reverse Y-axis"), uiOutput(ns("subvar")), uiOutput(ns("subval")) ) @@ -96,7 +97,7 @@ lineUI <- function(id, label = "lineplot") { #' @import shiny #' @importFrom data.table data.table .SD := #' @importFrom ggpubr ggline -#' @importFrom ggplot2 ggsave +#' @importFrom ggplot2 ggsave scale_y_reverse #' @importFrom rvg dml #' @importFrom officer read_pptx add_slide ph_with ph_location @@ -247,12 +248,19 @@ lineServer <- function(id, data, data_label, data_varStruct = NULL, nfactor.limi } - ggpubr::ggline(data, input$x_line, input$y_line, + res.plot <- ggpubr::ggline(data, input$x_line, input$y_line, color = color, add = add, add.params = add.params, conf.int = input$lineci, xlab = label[variable == input$x_line, var_label][1], ylab = label[variable == input$y_line, var_label][1], na.rm = T, linetype = linetype ) + + if (input$rev_y){ + res.plot <- res.plot + ggplot2::scale_y_reverse() + } + + return(res.plot) + }) output$downloadControls <- renderUI({