Skip to contents

Internal helper used by plot_stadia_data to trace a tv trajectory along the single nearest reference curve, since tv is recorded as a raw ml reading rather than one of the 12 Prader bead volumes. Unlike calculate_sds's tv handling (which interpolates continuously between the two surrounding beads), this snaps to whichever bead is closest, since a trajectory line can only follow one reference curve at a time.

Usage

snap_tv_to_nearest_bead(ml, refy_colnames)

Arguments

ml

Vector of raw testicular volume readings, in ml.

refy_colnames

Column names of the tv reference curves (e.g. "T1", "T2", ..., "T25"), i.e. colnames(ref$tv[, -1]) (see nl1997_lines), with the leading "age" column already dropped.

Value

Integer vector the same length as ml: the column index (into refy_colnames) of the nearest bead curve, or NA where ml is NA.