Description Usage Arguments Details Value Examples
Uses CDC height and weight expected values to add percentile lines to height/age or weight/age graphs.
1 2 |
p |
a ggplot object. |
category |
"WT" for a weight/age graph and "HT" for a height/age graph. |
sex |
0 for female, 1 for male |
inf_only |
TRUE if all ages are less than three years old. Default is FALSE. |
percentiles |
Which percentiles to include. Vector values containing any of "P3", "P5", "P10", "P25", "P50", "P75", "P90", "P95", or "P97". Default is c("P3", "P50", "P97") percentile, upper percentile will automatically be calculated. |
See https://www.cdc.gov/growthcharts/percentile_data_files.htm for information on the data used to make percentile lines.
Returns the ggplot object with lines representing the cdc growth-chart percentiles chosen.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | library(tidyverse)
# p1 plots age and weight for females
p1 <- ggplot(data = filter(htwt_example, SEX == 0)) +
aes(y = WT, x = AGE_Y) +
geom_point(alpha = .7) +
theme_minimal()
p1 <- viz_htwt(p = p1,
category = "WT",
sex = 0)
p1
# p2 plots age and weight for male infants
p2 <- ggplot(data = filter(htwt_example, SEX == 1 & AGE_Y < 3)) +
aes(y = WT, x = AGE_Y) +
geom_point(alpha = .7) +
theme_minimal()
p2 <- viz_htwt(p = p2,
category = "WT",
sex = 1,
inf_only = TRUE,
percentiles = c("P10", "P90"))
p2
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.