R/calculate_centile_table.R
calculate_centile_table.Rd
This function calculates centiles based on specified z-scores or percentiles
using a given reference. It requires the reference to be provided as a code
compatible with the centile
package.
calculate_centile_table(x, z = NULL, p = NULL, refcode = NULL, dec = 4, ...)
A vector with the grid (usually years, sometimes cm) on the horizontal axis.
A vector containing the z values of the desired centiles.
A vector containing the desired percentile values (between 0 and
100). The default p = NULL
does not calculate percentiles.
A reference code according to the specifications of the
centile
package. This code should match a pre-defined reference table
containing LMS values for various age or measurement groups.
Number of decimals needed for the output.
Additional arguments passed down to z2y()
.
A matrix
containing the desired centiles, with columns named
according to either the z-score values (e.g., Z-2
, Z0
, Z2
) or
percentiles (e.g., P3
, P50
, P97
).
# Centile table from WHO weight standard for boys aged 0-5 years
calculate_centile_table(z = -2:2, x = 0:5, refcode = "who_2006_wgt_male_")
#> Z-2 Z-1 Z0 Z1 Z2
#> [1,] 2.4593 2.8807 3.3464 3.8586 4.4194
#> [2,] 7.7422 8.6460 9.6479 10.7575 11.9858
#> [3,] 9.6725 10.8404 12.1515 13.6236 15.2767
#> [4,] 11.2790 12.7127 14.3429 16.1985 18.3131
#> [5,] 12.7126 14.4037 16.3489 18.5910 21.1808
#> [6,] 14.0680 16.0399 18.3365 21.0198 24.1650