Find matches on all outcomes shown on the active chart

find_matches(
  target,
  con,
  dnr,
  ynames,
  nmatch = 5L,
  period,
  user_model = 2L,
  exact_sex = FALSE,
  exact_ga = FALSE,
  break_ties = TRUE
)

Arguments

target

A list with elements "psn" and "xyz", e.g. as produced by bdsreader::read_bds()

con

A connection on which the donor data reside. The default (NULL) reads from donorloader package.

dnr

A string with the name of the donor data (currently available are smocc, terneuzen, lollypop, pops, 0-2, 2-4 and 4-18). The default (NULL) sets the donor data according to period[2].

ynames

A vector with the names of the response variables for which matches are sought, e.g. ynames = c("hdc", "hgt").

nmatch

Integer. Number of matches needed. When nmatch == 0L no matches are sought.

period

A vector of length 2 with left and right ages (decimal age). If length(period) == 0L, then no curve matching is done

user_model

Model number (1-4), indicating type of model the user wants. See details.

exact_sex

A logical indicating whether sex should be matched exactly

exact_ga

A logical indicating whether gestational age should be matched exactly

break_ties

A logical indicating whether ties should broken randomly. The default (TRUE) breaks ties randomly.

Value

List with components with names ynames. Each component is a vector of integers representing the id's of the matches cases from donor. Returns integer(0) if no matches are found.