Skip to contents

Returns a data frame for simulated donors clinical and demographic caracheristics.

Usage

donors_df(
  n = 10,
  replace = TRUE,
  origin = "PT",
  probs = c(0.4658, 0.0343, 0.077, 0.4229),
  lower = 18,
  upper = 75,
  mean = 60,
  sd = 12,
  uk = FALSE,
  n_seed = 3
)

Arguments

n

An integer to define the number of rows

replace

A logical value for sampling with replacement

origin

A character value for population origin from options: 'PT', 'API', 'AFA', 'CAU' and 'HIS'

probs

A vector with the probabilities for blood group A, AB, B and O (in this order). The sum of the probabilities must be equal to one.

lower

An integer for ages' lower limit.

upper

An integer for ages' upper limit.

mean

A value for mean's distribution.

sd

A value for standar deviation's distribution.

uk

A logical value, if TRUE is also computed the Donor Risk Index (DRI)

n_seed

a numeric seed that will be used for random number generation.

Value

A data frame with HLA typing, blood group and truncated ages for a simulated group of transplant donors.

Examples

donors_df(n = 10, replace = TRUE, origin = 'PT',
probs = c(0.4658, 0.0343, 0.077, 0.4229),
lower=18, upper=75, mean = 55, sd = 15,
uk = FALSE, n_seed = 3)
#> # A tibble: 10 x 9
#>    ID    bg       A1    A2    B1    B2   DR1   DR2   age
#>    <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
#>  1 D1    B         1    29     8    44    11     7    30
#>  2 D2    A         2     3     7    57     4     8    48
#>  3 D3    O        11    33    14    35     1    13    44
#>  4 D4    A        24    30    49    58    11    11    72
#>  5 D5    A         2     3     7    51     1    13    70
#>  6 D6    O        30    68    15    18     3     4    54
#>  7 D7    A         3    26    18    40    11    13    38
#>  8 D8    O         1     1     7     8     3    13    69
#>  9 D9    A         3     3     7    44    15     8    68
#> 10 D10   A        11    29    44    57     7     7    66