Merge the datasets on the keys
merge_datasets.Rd
Usage
merge_datasets(
selector_list,
datasets,
join_keys,
merge_function = "dplyr::full_join",
anl_name = "ANL"
)
Arguments
- selector_list
(
reactive
)
output fromdata_extract_multiple_srv()
or a reactive named list of outputs fromdata_extract_srv()
. When using a reactive named list, the names must be identical to the shiny ids of the respectivedata_extract_ui()
.- datasets
(named
list
ofreactive
or non-reactive
data.frame
)
object containing data as a list ofdata.frame
. When passing a list of non-reactivedata.frame
objects, they are converted to reactivedata.frame
objects internally.- join_keys
(
JoinKeys
)
of variables used as join keys for each of the datasets indatasets
. This will be used to extract thekeys
of every dataset.- merge_function
(
character(1)
orreactive
)
A character string of a function that accepts the argumentsx
,y
andby
to perform the merging of datasets.- anl_name
(
character(1)
)
Name of the analysis dataset.
Value
merged_dataset (list
) containing:
expr
(list
ofcall
) code needed to replicate merged dataset.-
columns_source
(list
) of column names selected for particular selector. Each list element contains named character vector where:Values are the names of the columns in the
ANL
. In case if the same column name is selected in more than one selector it gets prefixed by the id of the selector. For example if twodata_extract
have idx
,y
, then their duplicated selected variable (for exampleAGE
) is prefixed to bex.AGE
andy.AGE
.Names of the vector denote names of the variables in the input dataset.
attr(,"dataname")
to indicate which dataset variable is merged from.attr(, "always selected")
to denote the names of the variables which need to be always selected.
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.
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()))
}