Sets the data points in a graphic object. The function will identify and set all ynames in the graph.

set_curves(
  g,
  target,
  ynames,
  parsed,
  curve_interpolation = TRUE,
  nmatch = 0L,
  matches = NULL,
  dnr = NULL,
  period = numeric(0),
  show_realized = FALSE,
  show_future = FALSE,
  clip = TRUE,
  target_height = list(show = TRUE, alpha = 0.05)
)

Arguments

g

A gTree object, typically loaded by chartbox::load_chart()

target

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

ynames

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

parsed

A list, result of parse_chartcode(). Used for calculating the target height.

curve_interpolation

A logical indicating whether curve interpolation shoud be applied.

nmatch

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

matches

List of vector containing the id's of the matches in the donor data. List elements should be named after ynames. The default value (NULL) indicates that no matches are plotted.

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].

period

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

show_realized

A logical indicating whether the realized growth of the target child should be drawn

show_future

A logical indicating whether the predicted growth of the target child should be drawn

clip

A logical indicating whether clipping is needed

target_height

A list with two elements: show (logical) and alpha (numeric, e.g. 0.50 or 0.95).

Value

The grid object g with data points added.