Skip to contents

Extracts and returns all rows from the specified domain for the set of subjects included in animalList.

Usage

getSubjData(dbToken, animalList, domain, colList = NULL)

Arguments

dbToken

Mandatory
Token for the open database connection (see initEnvironment).

animalList

Mandatory, data.table.
A table with the list of animals to be included in the output data.
The table must include at least columns named 'STUDYID' and 'USUBJID'.

domain

Mandatory, character, not case sensitive.
The name of the domain table to extract data from.
The name must be a subject level domain - i.e. a table including a 'USUBJID' column.

colList

Optional, character, not case sensitive.
The list of columns to be extracted from the specified domain table.
It can be a single string, a vector or a list of multiple strings.

Value

The function returns a data.table with all the rows for the animals included in animalList.

If no columns have been specified in colList, all the columns in the table colList are included.

If a list of columns have been specified in colList, these are included. In addition, a set of columns are always included, whether they are included in colList or not:

  • To ensure each row can be uniquely identified:

    • DOMAIN

    • STUDYID

    • USUBJID

    • POOLID (if it exists)

    • domainSEQ (if it exists)

  • For finding tables - to support age calculation and evaluation of study phase:

    • domainDTC

    • domainDY

The order of the columns are as they are defined for the domain in the SEND IG.

The data table contains both

  • subject level data - i.e. rows where USUBJID is not empty

  • if applicable for the domain, pool level data - i.e. rows where POOLID is not empty.
    In this case, all pools, which includes any of the subjects included in animalList, are included

Examples

if (FALSE) {
# Extract all columns from DM:
getSubjData(myDbToken, myControlAnimals, 'dm')

# Extract selected columns from LB:
getSubjData(myDbToken, myControlAnimals, 'LB',
            list('LBTESTCD', 'LBCAT',
                 'LBSTRESC', 'LBSTRESN', 'LBSTRESU',
                 'LBSTAT', 'LBREASND',
                 'LBTPT'))
}