diff --git a/NEWS.md b/NEWS.md index 6c587706ca..aaa2ce60c7 100644 --- a/NEWS.md +++ b/NEWS.md @@ -13,6 +13,7 @@ * `tdata` has been deprecated and replaced with `teal_data`. Support for `tdata` passed to the `data` argument in `module(server)` will be removed in the next release. * `module(ui)` argument no longer accepts `data` and `datasets` arguments. All data dependent logic should be set in the server function. * `module(server)` argument deprecated `datasets` argument. `teal_module`s' server functions should accept `data` (`teal_data`) instead. +* Changed the order of formal arguments in `init`. `filter` now comes directly after `modules`, before `title`. ### Miscellaneous diff --git a/R/init.R b/R/init.R index cebedac179..9c0e3fa5f4 100644 --- a/R/init.R +++ b/R/init.R @@ -22,12 +22,12 @@ #' `teal_modules` or `teal_module` object. These are the specific output modules which #' will be displayed in the `teal` application. See [modules()] and [module()] for #' more details. +#' @param filter (`teal_slices`) +#' Specifies the initial filter using [teal_slices()]. #' @param title (`shiny.tag` or `character(1)`) #' The browser window title. Defaults to a title "teal app" with the icon of NEST. #' Can be created using the `build_app_title()` or #' by passing a valid `shiny.tag` which is a head tag with title and link tag. -#' @param filter (`teal_slices`) -#' Specifies the initial filter using [teal_slices()]. #' @param header (`shiny.tag` or `character(1)`) #' The header of the app. #' @param footer (`shiny.tag` or `character(1)`) @@ -74,7 +74,6 @@ #' datanames = "new_iris" #' ) #' ), -#' title = "App title", #' filter = teal_slices( #' teal_slice(dataname = "new_iris", varname = "Species"), #' teal_slice(dataname = "new_iris", varname = "Sepal.Length"), @@ -86,6 +85,7 @@ #' global_filters = "new_mtcars cyl" #' ) #' ), +#' title = "App title", #' header = tags$h1("Sample App"), #' footer = tags$p("Copyright 2017 - 2023") #' ) @@ -95,8 +95,8 @@ #' init <- function(data, modules, - title = build_app_title(), filter = teal_slices(), + title = build_app_title(), header = tags$p(), footer = tags$p(), id = character(0)) { diff --git a/R/module_teal_with_splash.R b/R/module_teal_with_splash.R index d31f852b96..a87f48fa64 100644 --- a/R/module_teal_with_splash.R +++ b/R/module_teal_with_splash.R @@ -99,7 +99,7 @@ ui_teal_with_splash <- function(id, #' @rdname module_teal_with_splash srv_teal_with_splash <- function(id, data, modules, filter = teal_slices()) { checkmate::assert_character(id, max.len = 1, any.missing = FALSE) - checkmate::check_multi_class(data, c("teal_data", "teal_data_module")) + checkmate::assert_multi_class(data, c("teal_data", "teal_data_module")) checkmate::assert_class(modules, "teal_modules") checkmate::assert_class(filter, "teal_slices") diff --git a/man/init.Rd b/man/init.Rd index 34af9ca5f9..e1f7aef32e 100644 --- a/man/init.Rd +++ b/man/init.Rd @@ -7,8 +7,8 @@ init( data, modules, - title = build_app_title(), filter = teal_slices(), + title = build_app_title(), header = tags$p(), footer = tags$p(), id = character(0) @@ -24,14 +24,14 @@ nested list of \code{teal_modules} or \code{teal_module} objects or a single will be displayed in the \code{teal} application. See \code{\link[=modules]{modules()}} and \code{\link[=module]{module()}} for more details.} +\item{filter}{(\code{teal_slices}) +Specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} + \item{title}{(\code{shiny.tag} or \code{character(1)}) The browser window title. Defaults to a title "teal app" with the icon of NEST. Can be created using the \code{build_app_title()} or by passing a valid \code{shiny.tag} which is a head tag with title and link tag.} -\item{filter}{(\code{teal_slices}) -Specifies the initial filter using \code{\link[=teal_slices]{teal_slices()}}.} - \item{header}{(\code{shiny.tag} or \code{character(1)}) The header of the app.} @@ -87,7 +87,6 @@ app <- init( datanames = "new_iris" ) ), - title = "App title", filter = teal_slices( teal_slice(dataname = "new_iris", varname = "Species"), teal_slice(dataname = "new_iris", varname = "Sepal.Length"), @@ -99,6 +98,7 @@ app <- init( global_filters = "new_mtcars cyl" ) ), + title = "App title", header = tags$h1("Sample App"), footer = tags$p("Copyright 2017 - 2023") ) @@ -106,4 +106,11 @@ if (interactive()) { shinyApp(app$ui, app$server) } +# this is run +print("ok") +\dontrun{ + stop("nooo") +} + + } diff --git a/vignettes/data-as-shiny-module.Rmd b/vignettes/data-as-shiny-module.Rmd index 840df84830..d64dfa5f0c 100644 --- a/vignettes/data-as-shiny-module.Rmd +++ b/vignettes/data-as-shiny-module.Rmd @@ -59,7 +59,7 @@ data_module <- teal_data_module( app <- init( data = data_module, - module = example_module() + modules = example_module() ) if (interactive()) { @@ -109,7 +109,7 @@ data_module <- teal_data_module( app <- init( data = data_module, - module = example_module() + modules = example_module() ) if (interactive()) { @@ -146,7 +146,7 @@ data_module_2 <- within( app <- init( data = data_module_2, - module = example_module() + modules = example_module() ) if (interactive()) {