Skip to contents

Simulate obesity status

Usage

simulate_obesity(
  x,
  obes_prev = "OBESITY_CrudePrev",
  obes_sd = "OBESITY_SD",
  obes_label = "FIPS",
  n = 1000
)

Arguments

x

data frame containing obesity data as a percentage from 0 to 100.

obes_prev

column name of prevalence.

obes_sd

column name of standard deviation.

obes_label

column name of labeling term, required if x has more than one row.

n

simulated sample size.

Value

List of arrays containing simulated obesity status.

Examples

# Input has default column names
df <- data.frame(OBESITY_CrudePrev = c(20, 50, 80),
                 OBESITY_SD = c(5, 5, 5),
                 FIPS = letters[1:3])
simulate_obesity(df, n = 5)
#> $a
#> [1] "Normal" "Normal" "Normal" "Normal" "Normal"
#> 
#> $b
#> [1] "Normal" "Obese"  "Normal" "Normal" "Normal"
#> 
#> $c
#> [1] "Obese" "Obese" "Obese" "Obese" "Obese"
#> 

# Input has custom column names
df <- data.frame(prev = c(20, 50, 80),
                 sd = c(5, 5, 5),
                 label = letters[1:3])
simulate_obesity(df,
                 obes_prev = "prev",
                 obes_sd = "sd",
                 obes_label = "label",
                 n = 5)
#> $a
#> [1] "Normal" "Obese"  "Normal" "Normal" "Normal"
#> 
#> $b
#> [1] "Normal" "Obese"  "Obese"  "Normal" "Obese" 
#> 
#> $c
#> [1] "Obese" "Obese" "Obese" "Obese" "Obese"
#>