getFindingsSubjAge {sendigR}R Documentation

Add the subject age at finding time - and optionally extract the set of findings within a specified range of age.

Description

Returns a data table with the set of findings rows included in the findings where the age of subjects at finding time is within the interval specified in fromAge to fromAge.
If the fromAge and fromAge are empty (null, na or empty string), all rows from findings are returned.

Usage

getFindingsSubjAge(
  dbToken,
  findings,
  animalList,
  fromAge = NULL,
  toAge = NULL,
  inclUncertain = FALSE,
  noFilterReportUncertain = TRUE
)

Arguments

dbToken

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

findings

Mandatory, data.table.
A table with the set of input finding rows to process.
The table must include at least columns named

  • STUDYID

  • USUBJID

  • DOMAIN

  • [domain]SEQ

  • [domain]DY

  • [domain]DTC

where [domain] is the name of the actual findings domain - e.g. LBSEQ, LBDY and LBDTC

animalList

Mandatory, data.table.
A data with the set of animals included in the findings table (may contain more animals than included in findings).
The data set must contain at least these columns returned by the function getControlSubj

  • STUDYID

  • USUBJID

  • RFSTDTC

  • DM_AGEDAYS

  • NO_AGE_MSG

fromAge

Optional, character
The start of age interval to extract.
Must be in a string in this format:
[value][age unit] where [age unit] is one of

  • d, day, days

  • w, week, weeks

  • m, month, months

  • y, year, years

The unit is case-insensitive, space(s) between age value and unit is allowed.

toAge

Optional. character
The start of age interval to extract.
Must be in a string in in the same format as described for fromAge.

inclUncertain

Mandatory, boolean.
Only relevant if the fromAge and/or toAge is/are not empty.
Indicates whether finding rows for which the age at finding time cannot be confidently identified, shall be included or not in the output data table.

noFilterReportUncertain

Optional, boolean.
Only relevant if the fromAge and toAge are empty.
Indicates if the reason should be included if the age at finding time cannot be confidently decided for an animal.

Details

In both situation, the subject age at finding time is calculated into an additional column AGEDAYS for each row in findings combined with the the additional input data.table animalList using this algorithm:

If both fromAge and toAge values are specified - all the rows from the input table findings where value of the calculated AGEDYAS is within the interval of the specified start/end age interval are returned - including the values equal to the start/end age values.
If only a fromAge value is specified - all the rows from the input table findings where value of AGEDYAS equal to or greater than the input age are returned.
If only a toAge value is specified - all the rows from input table findings where value of AGEDAYS is equal to or less than the input age are extracted and returned. The input age value(s) is/are converted to days before extraction of rows from the input data tables using the input value(s) as filter - using this conversion:

If input parameter inclUncertain=TRUE, findings rows where the age at finding time cannot be confidently identified are included in the output set. These uncertain situations are identified and reported (in column UNCERTAIN_MSG):

The same checks are performed and reported in column NOT_VALID_MSG if fromAge and fromAge are empty and noFilterReportUncertain = TRUE.

Value

The function returns a data.table with columns in this order:

Examples

## Not run: 
# Extract LB rows for the animals at age between 8 and 12 weeks at finding
# time - include uncertain rows
getFindingsSubjAge(dbToken = db,
                   findings = lb,
                   animalList = animals,
                   fromAge = '8w',
                   toAge = '12w',
                   inclUncertain = TRUE)
# No filtering, just add AGEDAYS to FW rows - do not include messages when
# the AGEDAYS cannot be confidently identified
getFindingsSubjAge(dbToken = db, findings = fw,  animalList = animals,
                   noFilterReportUncertain = FALSE)

## End(Not run)


[Package sendigR version 1.0.0 Index]