This function returns a data frame of the data in the Cohort Inclusion Tables. Results are organized in to a list with 5 different data frames:
cohortInclusionTable
cohortInclusionResultTable
cohortInclusionStatsTable
cohortSummaryStatsTable
cohortCensorStatsTable
These can be optionally specified with the outputTables
.
See exportCohortStatsTables
function for saving data to csv.
Usage
getCohortStats(
connectionDetails,
connection = NULL,
cohortDatabaseSchema,
databaseId = NULL,
snakeCaseToCamelCase = TRUE,
outputTables = c("cohortInclusionTable", "cohortInclusionResultTable",
"cohortInclusionStatsTable", "cohortInclusionStatsTable", "cohortSummaryStatsTable",
"cohortCensorStatsTable"),
cohortTableNames = getCohortTableNames()
)
Arguments
- connectionDetails
An object of type
connectionDetails
as created using thecreateConnectionDetails
function in the DatabaseConnector package. Can be left NULL ifconnection
is provided.- connection
An object of type
connection
as created using theconnect
function in the DatabaseConnector package. Can be left NULL ifconnectionDetails
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'.
- databaseId
Optional - when specified, the databaseId will be added to the exported results
- snakeCaseToCamelCase
Convert column names from snake case to camel case.
- outputTables
Character vector. One or more of "cohortInclusionTable", "cohortInclusionResultTable", "cohortInclusionStatsTable", "cohortInclusionStatsTable", "cohortSummaryStatsTable" or "cohortCensorStatsTable". Output is limited to these tables. Cannot export, for, example, the cohort table. Defaults to all stats tables.
- cohortTableNames
The names of the cohort tables. See
getCohortTableNames
for more details.