View source: R/mockProcedureOccurrence.R
mockProcedureOccurrence | R Documentation |
This function simulates condition occurrences for individuals within a specified cohort. It helps create a realistic dataset by generating condition records for each person, based on the number of records specified per person.The generated data are aligned with the existing observation periods to ensure that all conditions are recorded within valid observation windows.
mockProcedureOccurrence(cdm, recordPerson = 1, seed = NULL)
cdm |
A ‘cdm_reference' object that should already include ’person', 'observation_period', and 'concept' tables.This object is the base CDM structure where the procedure occurrence data will be added. It is essential that these tables are not empty as they provide the necessary context for generating condition data. |
recordPerson |
An integer specifying the expected number of condition records to generate per person.This parameter allows the simulation of varying frequencies of condition occurrences among individuals in the cohort, reflecting the variability seen in real-world medical data. |
seed |
An optional integer used to set the seed for random number generation, ensuring reproducibility of the generated data.If provided, it allows the function to produce the same results each time it is run with the same inputs.If 'NULL', the seed is not set, resulting in different outputs on each run. |
Returns the modified 'cdm' object with the new 'condition_occurrence' table added. This table includes the simulated condition data for each person, ensuring that each record is within the valid observation periods and linked to the correct individuals in the 'person' table.
library(omock)
# Create a mock CDM reference and add condition occurrences
cdm <- mockCdmReference() |>
mockPerson() |>
mockObservationPeriod() |>
mockProcedureOccurrence(recordPerson = 2)
# View the generated condition occurrence data
print(cdm$procedure_occurrence)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.