Select a pre-defined number of controls for each case based on calculated distances between cases and controls.
make_knn_strata(
expvar,
matchvars,
df,
rmvars = data.frame(exp_var = character(), rm_vars = character(), stringsAsFactors =
FALSE),
casevar = "case",
ncntls = 250,
metric = "gower",
silent = FALSE
)A list of data frames with a length of number of exposures of
interest.
A character - the name of the exposure variable in df.
Character vector - what are the variables to match on. Note that the function automatically excludes the the exposure variable.
A dataframe that contains the case-control data.
A data frame that lists variables to be excluded from matching for each exposure. For details, please see the vignette of this package.
A character - what is the name of the variable indicating case status (1 = case, 0 = control)
An integer to specify number of controls to find for each case (k in knn).
A character to specify a metric for measuring distance between
a case and a control. See daisy.
Suppress exposure info useful for *apply/loop implementations?
For more information, please refer to the vignette using
browseVignettes("nncc").