Skip to contents

[Stable] It combines/merges multiple datasets with specified keys attribute.

Usage

merge_datasets(
  selector_list,
  datasets,
  merge_function = "dplyr::full_join",
  anl_name = "ANL"
)

Arguments

selector_list

(reactive)
output from data_extract_multiple_srv() or a reactive named list of outputs from data_extract_srv(). When using a reactive named list, the names must be identical to the shiny ids of the respective data_extract_ui().

datasets

(FilteredData)
object containing data (see teal.slice::FilteredData).

merge_function

(character(1) or reactive)
A character string of a function that accepts the arguments x, y and by to perform the merging of datasets.

anl_name

(character(1))
Name of the analysis dataset.

Value

merged_dataset (list) containing:

  • data (data.frame) after filtering and reshaping containing selected columns.

  • expr (character) code needed to replicate merged dataset.

  • columns_source (list) of column selected for particular selector.

  • keys (list) the keys of the merged dataset.

  • filter_info (list) The information given by the user. This information defines the filters that are applied on the data. Additionally it defines the variables that are selected from the data sets.

Details

Internally this function uses calls to allow reproducibility.

Examples

if (FALSE) {
# inside teal module server function
response <- data_extract_srv(
  id = "reponse",
  data_extract_spec = response_spec,
  datasets = datasets
)
regressor <- data_extract_srv(
  id = "regressor",
  data_extract_spec = regressor_spec,
  datasets = datasets
)
merged_data <- merge_datasets(list(regressor(), response()))
}