Generate simulated locality variables data
dummy_locality.RdThis function creates a synthetic dataset with a subset of variables that are contained in the GEMINI "locality-variables" table, as seen in GEMINI Data Repository Dictionary.
Specifically, the function simulates dissemination area IDs (da21uid) based on Canadian census data for a user-specified set of mock encounter and hospital IDs. To mimic GEMINI data characteristics, the majority of simulated area IDs are drawn from Ontario and are clustered by hospital.
Arguments
- nid
(
integer)
Number of unique encounter IDs to simulate. In this data table, each ID occurs once. It is optional whencohortis provided.- n_hospitals
(
integer)
Number of hospitals in simulated dataset. It is optional whencohortis provided.- cohort
(
data.frame or data.table) Optional, an existing data frame or data table similar toadmdadin GEMINI with at least the following columns:genc_id(integer): Mock encounter ID, integers starting from 1 or fromcohorthospital_num(integer): Mock hospital ID, integers starting from 1 or fromcohortIfcohortis provided,nidandn_hospitalinputs are not used.
- da21uid
(
integerorvector)
Optional, allows the user to customize which dissemination area ID(s) to include in the output.- seed
(
integer)
Optional, a number to be used to set the seed for reproducible results.
Value
(data.table)
A data.table object similar to the "locality_variables" table that contains the following fields:
genc_id(integer): Mock encounter ID; integers starting from 1 or fromcohortif providedda21uid(integer): Dissemination area ID based on 2021 Canadian census data using PCCF Version 8A
Examples
dummy_locality(nid = 1000, n_hospitals = 10)
#> genc_id hospital_num da21uid
#> <int> <int> <num>
#> 1: 1 5 35570408
#> 2: 2 6 35340035
#> 3: 3 7 35212127
#> 4: 4 4 35260466
#> 5: 5 6 35420211
#> ---
#> 996: 996 9 35260754
#> 997: 997 2 35290008
#> 998: 998 2 35290044
#> 999: 999 2 35310222
#> 1000: 1000 7 35120241