Skip to contents

This module manages the data argument for srv_teal. The teal framework uses teal_data(), which can be provided in various ways:

  1. Directly as a teal.data::teal_data() object. This will automatically convert it into a reactive teal_data.

  2. As a reactive object that returns a teal.data::teal_data() object.

Usage

ui_init_data(id)

srv_init_data(id, data)

Arguments

id

(character) Optionally, a string specifying the shiny module id in cases it is used as a shiny module rather than a standalone shiny app. This is a legacy feature.

data

(teal_data, teal_data_module, or reactive returning teal_data) The data which application will depend on.

Value

A reactive object that returns: Output of the data. If data fails then returned error is handled (after tryCatch()) so that rest of the application can respond to this respectively.

Details

Reactive teal_data:

The data in the application can be reactively updated, prompting srv_teal() to rebuild the content accordingly. There are two methods for creating interactive teal_data:

  1. Using a reactive object provided from outside the teal application. In this scenario, reactivity is controlled by an external module, and srv_teal responds to changes.

  2. Using teal_data_module(), which is embedded within the teal application, allowing data to be resubmitted by the user as needed.

Since the server of teal_data_module() must return a reactive teal_data object, both methods (1 and 2) produce the same reactive behavior within a teal application. The distinction lies in data control: the first method involves external control, while the second method involves control from a custom module within the app.

For more details, see module_teal_data.