## ----include = FALSE---------------------------------------------------------- library(tanner) # render at plot_stadia()'s native A4-landscape device size (matching # README.qmd) since plot_stadia_general() places text at hardcoded # coordinates tuned for that size; scale down only the displayed image # (out.width), not the R graphics device itself, to fit the page column knitr::opts_chunk$set( fig.width = 11.67, fig.height = 8.27, dpi = 150, out.width = "100%" ) ## ----multi-stage-boy---------------------------------------------------------- boy <- data.frame( id = 1, age = c(9.1, 10.2, 11.3, 12.1, 12.9, 13.8, 14.6, 15.2), sex = "M", gen = c(1, 1, 2, 3, 3, 4, 4, 5), phb = c(1, 1, 1, 2, 3, 4, 4, 5), tv = c(2, 3, 4, 8, 10, 12, 15, 20) ) plot_stadia( data = boy, persons = 1, type = c(TRUE, TRUE, TRUE), plotline = c(FALSE, FALSE, FALSE), colors = c("#0060A0", "#00A000", "#A00000"), title = "Boy 1: genital, pubic hair & testicular volume", padid = FALSE ) ## ----overlay-boys------------------------------------------------------------- boys <- data.frame( id = rep(c(1, 2), each = 4), age = c(9, 11, 13, 15, 10, 12, 14, 16), sex = "M", gen = c(1, 2, 3, 5, 1, 1, 3, 4), phb = c(1, 2, 3, 5, 1, 2, 3, 4), tv = NA ) plot_stadia( data = boys, persons = c(1, 2), type = c(TRUE, FALSE, FALSE), plotline = c(TRUE, FALSE, FALSE), overlay = TRUE, ovsex = "M", title = "Genital stage, two boys overlaid", padid = FALSE ) ## ----tv-interpolation--------------------------------------------------------- # 11ml is strictly between the T10 and T12 Prader bead curves; age must # be supplied per stage value (no recycling), so it's repeated here calculate_sds(age = c(13, 13, 13), stage = c(10, 11, 12), type = "tv") ## ----ref-shape---------------------------------------------------------------- head(tanner::nl1997$gen)