From bbaff1f1a476afe0e776edfbec7dffe5beeff4c6 Mon Sep 17 00:00:00 2001 From: Aleksander Chlebowski Date: Thu, 9 Nov 2023 16:00:42 +0100 Subject: [PATCH] update documentation for teal_data_module --- R/teal_data_module.R | 19 ++++++++++++++----- man/teal_data_module.Rd | 20 +++++++++++++++----- 2 files changed, 29 insertions(+), 10 deletions(-) diff --git a/R/teal_data_module.R b/R/teal_data_module.R index e1e0400803..facd526610 100644 --- a/R/teal_data_module.R +++ b/R/teal_data_module.R @@ -1,13 +1,22 @@ -#' Data module +#' Data module for `teal` applications #' -#' Data input for `teal::init` in form of a module +#' Create `shiny` module to supply or modify data in a `teal` application. +#' +#' This function creates a `shiny` module that allows for running data pre-processing code after the app starts. +#' The body of the server function will be run in the app rather than in the global environment. +#' This means it will be run every time the app starts, so use sparingly. +#' +#' Pass this module instead of a `teal_data` object in a call to `init`. +#' +#' See vignette "Data as shiny Module" for more details. #' #' @param ui (`function(id)`)\cr -#' `shiny` `ui` module with `id` argument +#' `shiny` module `ui` function; must only take `id` argument #' @param server (`function(id)`)\cr -#' `shiny` server function with `id` as argument. Module should return reactive `teal_data`. +#' `shiny` module `ui` function; must only take `id` argument; +#' must return reactive expression containing `teal_data` object #' -#' @return object of class `teal_data_module` +#' @return Object of class `teal_data_module`. #' #' @examples #' data <- teal_data_module( diff --git a/man/teal_data_module.Rd b/man/teal_data_module.Rd index d976065943..e2fb4ea89a 100644 --- a/man/teal_data_module.Rd +++ b/man/teal_data_module.Rd @@ -2,22 +2,32 @@ % Please edit documentation in R/teal_data_module.R \name{teal_data_module} \alias{teal_data_module} -\title{Data module} +\title{Data module for \code{teal} applications} \usage{ teal_data_module(ui, server) } \arguments{ \item{ui}{(\verb{function(id)})\cr -\code{shiny} \code{ui} module with \code{id} argument} +\code{shiny} module \code{ui} function; must only take \code{id} argument} \item{server}{(\verb{function(id)})\cr -\code{shiny} server function with \code{id} as argument. Module should return reactive \code{teal_data}.} +\code{shiny} module \code{ui} function; must only take \code{id} argument; +must return reactive expression containing \code{teal_data} object} } \value{ -object of class \code{teal_data_module} +Object of class \code{teal_data_module}. } \description{ -Data input for \code{teal::init} in form of a module +Create \code{shiny} module to supply or modify data in a \code{teal} application. +} +\details{ +This function creates a \code{shiny} module that allows for running data pre-processing code after the app starts. +The body of the server function will be run in the app rather than in the global environment. +This means it will be run every time the app starts, so use sparingly. + +Pass this module instead of a \code{teal_data} object in a call to \code{init}. + +See vignette "Data as shiny Module" for more details. } \examples{ data <- teal_data_module(