Skip to contents

Create a fake subject database with clustering

Usage

create_fake_subjectDB_clustered(
  n_subjects = 50,
  n_facilities = 10,
  avg_n_stays = 3,
  days_since_discharge = NULL,
  length_of_stay = NULL,
  n_clusters = 3
)

Arguments

n_subjects

the number of different subjects in the database

n_facilities

the number of facility present in the database

avg_n_stays

the average number of stays per subject

days_since_discharge

the number of days between a discharge date and an admission date (default: max(0, rnorm(1, mean = 30, sd = 10)))

length_of_stay

the length of stay (default: max(1, rnorm(1, mean = 5, sd = 3) )

n_clusters

the number of cluster in the network

Value

a data.table containing all subjects stays

Examples

mydb <- create_fake_subjectDB_clustered(n_subjects = 100, n_facilities = 10)
mydb
#>         sID    fID      Adate      Ddate
#>      <char> <char>     <POSc>     <POSc>
#>   1:    s01     f8 2019-02-04 2019-02-11
#>   2:    s02     f9 2019-01-26 2019-02-05
#>   3:    s02     f9 2019-03-17 2019-03-24
#>   4:    s02     f2 2019-04-07 2019-04-10
#>   5:    s03     f9 2019-02-04 2019-02-13
#>  ---                                    
#> 266:    s86     f2 2019-04-12 2019-04-24
#> 267:    s90     f6 2019-06-28 2019-07-07
#> 268:    s96     f6 2019-04-25 2019-05-03
#> 269:    s97     f3 2019-05-23 2019-05-31
#> 270:    s94     f8 2019-05-04 2019-05-08