simulate_age {GeoTox} | R Documentation |
Simulate ages
Description
Simulate ages
Usage
simulate_age(x, n = 1000)
Arguments
x |
data frame or list of data frames containing population data for age groups. Each data frame must contain columns "AGEGRP" and "TOT_POP". |
n |
simulated sample size. |
Details
Each data frame must contain 19 rows. The first row represents the total population of all age groups while the next 18 rows represent age groups from 0 to 89 in increments of 5 years.
Value
List of arrays containing simulated ages.
Examples
# Single data frame
x <- data.frame(AGEGRP = 0:18, TOT_POP = 0)
# populate only age range 40-44, set population total of all ages
x$TOT_POP[c(1, 10)] <- 100
simulate_age(x, 5)
# List of 2 data frames
y <- data.frame(AGEGRP = 0:18, TOT_POP = 0)
# populate age ranges 5-9 and 50-54
y$TOT_POP[c(3, 12)] <- 10
# set population total for all age groups
y$TOT_POP[1] <- sum(y$TOT_POP)
simulate_age(list(x = x, y = y), 15)
[Package GeoTox version 0.2.0 Index]