insertDbPopulation: Insert cases and controls into a database

View source: R/DataLoadingSaving.R

insertDbPopulationR Documentation

Insert cases and controls into a database

Description

Insert cases and controls into a database

Usage

insertDbPopulation(
  caseControls,
  cohortIds = c(1, 0),
  connectionDetails,
  cohortDatabaseSchema,
  cohortTable = "cohort",
  createTable = FALSE,
  dropTableIfExists = TRUE
)

Arguments

caseControls

A data frame as generated by the selectControls function.

cohortIds

The IDs to be used for the cohorts of cases and controls, respectively.

connectionDetails

An R object of type
connectionDetails created using the function createConnectionDetails in the DatabaseConnector package.

cohortDatabaseSchema

The name of the database schema where the data will be written. Requires write permissions to this database. On SQL Server, this should specify both the database and the schema, so for example 'cdm_instance.dbo'.

cohortTable

The name of the table in the database schema where the data will be written.

createTable

Should a new table be created? If not, the data will be inserted into an existing table.

dropTableIfExists

If createTable = TRUE and the table already exists it will be overwritten.

Details

Inserts cases and controls into a database. The table in the database will have the same structure as the 'cohort' table in the Common Data Model.


OHDSI/CaseControl documentation built on July 15, 2022, 6:33 a.m.