This function retrieves the data from the cohort statistics tables and writes them to the inclusion statistics folder specified in the function call.

exportCohortStatsTables(
  connectionDetails,
  connection = NULL,
  cohortDatabaseSchema,
  cohortTableNames = getCohortTableNames(),
  cohortStatisticsFolder,
  snakeCaseToCamelCase = TRUE,
  fileNamesInSnakeCase = FALSE,
  incremental = FALSE,
  databaseId = NULL
)

Arguments

connectionDetails

An object of type connectionDetails as created using the createConnectionDetails function in the DatabaseConnector package. Can be left NULL if connection is provided.

connection

An object of type connection as created using the connect function in the DatabaseConnector package. Can be left NULL if connectionDetails is provided, in which case a new connection will be opened at the start of the function, and closed when the function finishes.

cohortDatabaseSchema

Schema name where your cohort tables reside. Note that for SQL Server, this should include both the database and schema name, for example 'scratch.dbo'.

cohortTableNames

The names of the cohort tables. See getCohortTableNames for more details.

cohortStatisticsFolder

The path to the folder where the cohort statistics folder where the results will be written

snakeCaseToCamelCase

Should column names in the exported files convert from snake_case to camelCase? Default is FALSE

fileNamesInSnakeCase

Should the exported files use snake_case? Default is FALSE

incremental

If incremental = TRUE, results are written to update values instead of overwriting an existing results

databaseId

Optional - when specified, the databaseId will be added to the exported results