Generate Anthropometric Measurements for Males and Females.
h_anthropometrics_by_sex.Rd
Anthropometric measurements are randomly generated using normal approximation. The default mean and standard deviation values used are based on US National Health Statistics for adults aged 20 years or over. The measurements are generated in same units as provided to the function.
Usage
h_anthropometrics_by_sex(
df,
seed = 1,
id_var = "USUBJID",
sex_var = "SEX",
sex_var_level_male = "M",
male_weight_in_kg = list(mean = 90.6, sd = 44.9),
female_weight_in_kg = list(mean = 77.5, sd = 46.2),
male_height_in_m = list(mean = 1.75, sd = 0.14),
female_height_in_m = list(mean = 1.61, sd = 0.24)
)
Arguments
- df
(
data.frame
)
Analysis dataset.- seed
(
numeric
)
Seed to use for reproducible random number generation.- id_var
(
character
)
Patient identifier variable name.- sex_var
(
character
)
Name of variable representing sex of patient.- sex_var_level_male
(
character
)
Level ofsex_var
representing males.- male_weight_in_kg
(named
list
)
List of means and SDs of male weights in kilograms.- female_weight_in_kg
(named
list
)
List of means and SDs of female weights in kilograms.- male_height_in_m
(named
list
)
List of means and SDs of male heights in metres.- female_height_in_m
(named
list
)
list of means and SDs of female heights in metres.
Examples
library(random.cdisc.data)
adsl <- radsl(N = 5, seed = 1)
df_with_measurements <- random.cdisc.data:::h_anthropometrics_by_sex(df = adsl)
df_with_measurements
#> # A tibble: 5 × 5
#> USUBJID SEX WEIGHT HEIGHT BMI
#> <chr> <fct> <dbl> <dbl> <dbl>
#> 1 AB12345-CHN-17-id-2 F 39.6 1.60 15.5
#> 2 AB12345-CHN-16-id-1 M 98.8 1.80 30.4
#> 3 AB12345-RUS-14-id-4 M 53.1 1.66 19.2
#> 4 AB12345-CHN-11-id-5 M 162. 1.44 78.2
#> 5 AB12345-USA-14-id-3 M 105. 1.91 29.0