- you find a list of available reference tables by region and by item here.
- version 0.6.4 from cran via
install.packages()
or the respective menu
library(childsds)
## generate example data
x <- data.frame(height=c(50,100,60,54),
sex=c("m","f","f","m"),
age=c(0,2.9,0.6,0.2))
x$height.sds <- sds(value = x$height,
age = x$age,
sex = x$sex, male = "m", female = "f",
ref = who.ref, item = "height")
head(x)
#+RESULTS[46a6ba3828dbb6c977bc976a6280e0b191bc02ee]:
height sex age height.sds 1 50 m 0.0 0.06116878 2 100 f 2.9 1.54150151 3 60 f 0.6 -3.26293906 4 54 m 0.2 -2.82189275
library(childsds)
head(tab <- make_percentile_tab(ref = nl4.ref,
item = "heightM",
perc = c(5,50,95),
age = 1:3))
sex age perc_05_0 perc_50_0 perc_95_0 nu mu sigma 1 male 1 72.82291 77.15261 81.48232 1 77.15261 0.03411775 2 male 2 82.10371 87.67000 93.23629 1 87.67000 0.03860000 3 male 3 89.97701 96.28000 102.58299 1 96.28000 0.03980000 4 female 1 70.58366 74.89305 79.20245 1 74.89305 0.03498225 5 female 2 82.06492 86.76000 91.45508 1 86.76000 0.03290000 6 female 3 89.41744 94.83000 100.24256 1 94.83000 0.03470000
library(childsds)
head(tab <- make_percentile_tab(ref = nl4.ref,
item = "heightM",
perc = c(5,50,95),
age = seq(0,20,by=0.1),
stack = T))
age sex variable value 1 0.0 male perc_05_0 47.82905 2 0.1 male perc_05_0 51.65139 3 0.2 male perc_05_0 55.37913 4 0.3 male perc_05_0 58.68443 5 0.4 male perc_05_0 61.60275 6 0.5 male perc_05_0 64.21947
library(ggplot2)
ggplot(tab, aes( x = age, y = value, group=paste(sex, variable))) +
geom_line(aes(linetype = sex)) +
theme_classic() +
theme(legend.position = c(0.1,0.8))