mockCdmFromTables {omock} | R Documentation |
Creates a mock cdm_reference from a preexisting cdm_reference object (it can be empty) and a list of tables. It makes sure that all the observations are within observation and all individuals are present in person table.
Description
Creates a mock cdm_reference from a preexisting cdm_reference object (it can be empty) and a list of tables. It makes sure that all the observations are within observation and all individuals are present in person table.
Usage
mockCdmFromTables(cdm = mockCdmReference(), tables = list(), seed = NULL)
Arguments
cdm |
A cdm_reference object |
tables |
List of named tables. They can be either omop standard tables or cohort tables. |
seed |
An integer to fix the seed of random numbers. If NULL seed is not set. |
Value
a cdm object
Examples
library(omock)
library(dplyr)
cohort <- tibble(
cohort_definition_id = c(1, 1, 2, 2, 1, 3, 3, 3, 1, 3),
subject_id = c(1, 4, 2, 3, 5, 5, 4, 3, 3, 1),
cohort_start_date = as.Date(c(
"2020-04-01", "2021-06-01", "2022-05-22", "2010-01-01", "2019-08-01",
"2019-04-07", "2021-01-01", "2008-02-02", "2009-09-09", "2021-01-01"
)),
cohort_end_date = cohort_start_date
)
cdm <- mockCdmFromTables(tables = list(cohort = cohort))
cdm
cdm$cohort
cdm$person
[Package omock version 0.2.0 Index]