matchLinkServer: Shiny server module for interactive drag-and-drop variable...

View source: R/matchLink.R

matchLinkServerR Documentation

Shiny server module for interactive drag-and-drop variable linkage or harmonization

Description

Given two datasets, a "reference" and an "external" or "comparison" dataset, both presumably containing at least some of the same variables, this module implements a drag-and-drop interface that allows users to interactively harmonize variables (pair them) as parameters for matching.

Usage

matchLinkServer(
  id,
  refdata,
  inputdata,
  vars,
  guess = NULL,
  informd = system.file("info/matching_methods.Rmd", package = "DIVE")
)

Arguments

id

Character ID for specifying namespace, see shiny::NS.

refdata

Reactive reference data.table.

inputdata

Reactive data.table, typically provided by customDatasetServer.

vars

A named list of a variable set (or sets) in the data that is allowed for matching. See details.

guess

Optional, name of the function to call for initial guessing of harmonized variables. See details.

informd

Optional, relative path to an info Rmarkdown file that will be pulled up in a help modal. Recommend using for providing methods details of the matching algorithm.

Details

The drops are initialized with the specified vars in refdata, and then a "variable bank" is initialized when given inputdata. vars should be provided as a list such as list(Variables = c("age", "sex", "BMI", "biomarkerLevel")) or list(Demographic = c("age", "sex"), Clinical = c("BMI", "biomarkerLevel")).

A guess function can be provided to attempt guessing which variables are actually the same between the datasets, which will run and pre-populate the pairs before the user does manual linkage of variables The guess function should be specific to the dataset and the domain. For example, if we can expect demographic-type datasets, the function can look for "sex" or "gender" in the incoming dataset to be matched with "sex" in the reference data, so that the user doesn't have to specify this manually. Its return should contain a list with all matchable variables in refdata and the match in inputdata, or NULL if no match.

Value

The returned reactive list is intended to be used as inputs to matchResultServer:

  1. params$matchOpts contains all the possible variables that could be used between the two datasets

  2. params$matchOn contains variables that were actually paired up for matching

  3. params$run transmits the "finalized" params/triggers matchResultServer


avucoh/DIVE documentation built on Aug. 29, 2023, 6:02 p.m.