Simulate external exposure
Value
list of matrices containing inhalation rates. Matrix columns are
named using the values in the expos_label
column for more than one data
frame row. Columns are sorted to have consistent order across functions.
Details
The sample size can be either a single value or a vector the same length as the number of data frames in x. If a single value is provided, the same sample size is used for all data frames. If a vector is provided, each element corresponds to the sample size for each data frame in x.
Examples
# Single data frame
x <- data.frame(mean = 1:3, sd = (1:3) / 10, casn = letters[1:3])
simulate_exposure(x, n = 5)
#> [[1]]
#> a b c
#> [1,] 1.0026159 1.800585 2.434379
#> [2,] 1.0090062 2.231229 3.298548
#> [3,] 1.0471949 2.209388 2.924024
#> [4,] 1.0453863 2.097000 2.851849
#> [5,] 0.9900689 2.144844 2.552586
#>
# List of 2 data frames
y <- data.frame(mean = 4:6, sd = 0.1, casn = letters[1:3])
simulate_exposure(list(loc1 = x, loc2 = y), n = 5)
#> $loc1
#> a b c
#> [1,] 0.8479832 1.837657 3.477917
#> [2,] 0.9657510 2.047440 3.110733
#> [3,] 1.1139573 1.581332 3.178866
#> [4,] 0.9297232 2.132157 2.881663
#> [5,] 0.9611832 2.008454 2.765319
#>
#> $loc2
#> a b c
#> [1,] 4.123251 5.180368 5.905022
#> [2,] 3.956679 5.148468 6.025342
#> [3,] 3.924222 4.970195 5.885813
#> [4,] 4.126354 4.864046 5.932410
#> [5,] 3.942908 5.132981 5.907200
#>
# different sample sizes
simulate_exposure(list(loc1 = x, loc2 = y), n = c(5, 3))
#> $loc1
#> a b c
#> [1,] 0.9003033 1.922687 2.810165
#> [2,] 1.0750556 2.075788 2.670900
#> [3,] 0.9595282 2.088941 3.263092
#> [4,] 1.0136440 2.008087 3.344679
#> [5,] 0.9072313 1.920419 2.848441
#>
#> $loc2
#> a b c
#> [1,] 4.107746 4.960440 6.058237
#> [2,] 4.116676 4.848675 5.975649
#> [3,] 4.039592 4.975872 5.876136
#>
# Input has custom column names
z <- data.frame(ave = 1:3, stdev = (1:3) / 10, chnm = letters[1:3])
simulate_exposure(z,
expos_mean = "ave",
expos_sd = "stdev",
expos_label = "chnm",
n = 5)
#> [[1]]
#> a b c
#> [1,] 0.9668607 2.041625 3.145356
#> [2,] 1.2078615 1.965819 2.802819
#> [3,] 1.0816877 1.898406 2.674048
#> [4,] 0.9585546 2.020088 3.017070
#> [5,] 1.1093389 1.728813 2.674041
#>