From 6d8bfca70203b9d9d375f158d3705f6b93f75578 Mon Sep 17 00:00:00 2001 From: GuidoMaggio Date: Thu, 16 May 2024 18:00:36 +0200 Subject: [PATCH 1/2] closes #1 Duplicated hist --- NEWS.md | 2 +- R/app_server.R | 3 ++- R/app_ui.R | 3 ++- R/mod_faithful_hist.R | 5 +++-- man/mod_faithful_hist.Rd | 4 +++- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/NEWS.md b/NEWS.md index 622dcff..f3b9fdd 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,3 @@ # shinyfaithful (development version) -* Initial CRAN submission. +* Duplicated histogram (#1). diff --git a/R/app_server.R b/R/app_server.R index da78de0..68a0183 100644 --- a/R/app_server.R +++ b/R/app_server.R @@ -6,5 +6,6 @@ #' @noRd app_server <- function(input, output, session) { # Your application server logic - mod_faithful_hist_server("hist") + mod_faithful_hist_server("hist-waiting", variable = "waiting") + mod_faithful_hist_server("hist-eruptions", variable = "eruptions") } diff --git a/R/app_ui.R b/R/app_ui.R index 83966d6..aac8e6a 100644 --- a/R/app_ui.R +++ b/R/app_ui.R @@ -11,7 +11,8 @@ app_ui <- function(request) { # Your application UI logic fluidPage( h1("Old Faithful Geyser - Hist"), - mod_faithful_hist_ui("hist") + mod_faithful_hist_ui("hist-waiting"), + mod_faithful_hist_ui("hist-eruptions") ) ) } diff --git a/R/mod_faithful_hist.R b/R/mod_faithful_hist.R index b8b2443..a79ad0b 100644 --- a/R/mod_faithful_hist.R +++ b/R/mod_faithful_hist.R @@ -28,13 +28,14 @@ mod_faithful_hist_ui <- function(id) { } #' @rdname mod_faithful_hist +#' @param variable character column name of faithful data #' #' @import shiny -mod_faithful_hist_server <- function(id){ +mod_faithful_hist_server <- function(id, variable){ moduleServer( id, function(input, output, session){ ns <- session$ns # generate bins based on input$bins from ui.R - variable <- "waiting" + # variable <- "waiting" x <- datasets::faithful[, variable, drop = FALSE] bins <- reactive(seq(min(x), max(x), length.out = input$bins + 1)) diff --git a/man/mod_faithful_hist.Rd b/man/mod_faithful_hist.Rd index 29124d2..0fd04a4 100644 --- a/man/mod_faithful_hist.Rd +++ b/man/mod_faithful_hist.Rd @@ -8,10 +8,12 @@ \usage{ mod_faithful_hist_ui(id) -mod_faithful_hist_server(id) +mod_faithful_hist_server(id, variable) } \arguments{ \item{id}{Internal parameter for {shiny}.} + +\item{variable}{character column name of faithful data} } \description{ UI and server function for an example Shiny module. From 0c1a9d4849de7bf9169c1c0917dfd9cee13977df Mon Sep 17 00:00:00 2001 From: GuidoMaggio Date: Thu, 16 May 2024 18:09:28 +0200 Subject: [PATCH 2/2] * Duplicated histogram (#1). --- DESCRIPTION | 2 +- NEWS.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 37b4a79..1b99f7b 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: shinyfaithful Title: Shiny4 workshop pkg -Version: 0.0.0.9000 +Version: 1.0.0 Authors@R: person('Guido', 'Maggio', email = 'guido.maggio@mirai-solutions.com', role = c('cre', 'aut')) Description: Package used for the 4th course of the Series Intro to Shiny. License: MIT + file LICENSE diff --git a/NEWS.md b/NEWS.md index f3b9fdd..0e2ce69 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,3 @@ -# shinyfaithful (development version) +# shinyfaithful 1.0.0 * Duplicated histogram (#1).