Skip to contents

Simulate external exposure

Usage

simulate_exposure(
  x,
  expos_mean = "mean",
  expos_sd = "sd",
  expos_label = "casn",
  n = 1000
)

Arguments

x

data frame or list of data frames containing exposure data.

expos_mean

column name of mean values.

expos_sd

column name of standard deviations.

expos_label

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

n

simulated sample size.

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.

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,] 0.9162794 2.281386 2.789820
#> [2,] 1.1026353 1.967633 3.487486
#> [3,] 1.0853874 2.147120 3.011090
#> [4,] 1.0825224 2.019398 2.887788
#> [5,] 1.0253444 2.005498 2.768367
#> 

# 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.9666123 2.243208 2.792414
#> [2,] 1.0642952 1.782184 3.002066
#> [3,] 1.0436256 2.108897 2.953796
#> [4,] 1.0095881 2.092255 2.982321
#> [5,] 1.0328365 1.702447 2.840226
#> 
#> $loc2
#>             a        b        c
#> [1,] 4.107907 4.881840 5.857508
#> [2,] 4.087462 5.005932 6.193692
#> [3,] 3.933398 4.816838 6.068842
#> [4,] 3.887372 5.081374 6.032434
#> [5,] 3.963056 4.851518 5.986116
#> 

# 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.8816355 2.109681 2.680272
#> [2,] 1.1612367 1.748522 2.695804
#> [3,] 0.9356836 2.200177 2.590011
#> [4,] 0.8834284 2.062633 2.469749
#> [5,] 1.0313530 1.803894 2.830455
#>