Learn R Programming

rEHR (version 1.0)

match_case: Selected controls matching a list of variables from a case

Description

Helper function for get_matches() This function wil perform incidence density sampling or exact sampling up to a supplied number of matched controls

Usage

match_case(matcher, control_pool, n_controls, id, replace)

Arguments

matcher
list of character strings defining the matching conditions
control_pool
dataframe of potential controls for matching
n_controls
The number of controls for each case. If replace == FALSE this is a maximum value
id
named vector of length 1 for the variable name and value of the case identifier
replace
logical should sampling of matched controls be with replacement (incident density sampling) or not.

Value

A dataframe of matched controls or NULL if no controls could be found