filterData {patientProfilesVis} | R Documentation |
Filter a dataset for records of interest, for use in the patient profiles.
Description
Data is filtered based on the following workflow:
The subset dataset (of
data
if not specified) is filtered based on subject variable and value (if specified).If a external subset dataset is specified, only the subject IDs of this filtered dataset are considered.
The
data
is filtered based on the selected subjects, fromsubjectSubset
(if specified) or from step 2.The data is filtered based on a random selection of subjects, if
subjectSample
is specified.
This filtering workflow is used for all subject profile visualization functions of the package.
Usage
filterData(
data,
subsetData = NULL,
subsetVar = NULL,
subsetValue = NULL,
subjectVar = "USUBJID",
subjectSubset = NULL,
subjectSample = NULL,
seed = 123
)
Arguments
data |
Data.frame with data |
subsetData |
(optional) Data.frame with extra dataset to filter on.
This dataset is filtered, and only records from |
subsetVar |
(optional) String with variable of subset data to filter on.
|
subsetValue |
(optional) Character vector with value(s) of interest to
retain in the filtered data.
These values should be available in |
subjectVar |
String, variable of data (and subset data) with subject ID. |
subjectSubset |
(optional) Character vector with subjects of interest
(available in |
subjectSample |
(optional) Integer of length 1 with number of random subject(s) that should be considered, e.g. to check the created patient profiles for a subset of the data. By default, all specified subjects are considered (set to NULL). |
seed |
(optional) Integer of length 1 with seed used to select random subjects
if |
Value
possibly filtered dataset
Author(s)
Laure Cougnaud
Examples
library(clinUtils)
data(dataSDTMCDISCP01)
dataAll <- dataSDTMCDISCP01
# keep only a subset of subjects
# (e.g. to visualize specified patient profiles
# before creating them for all subject)
filterData(
data = dataAll$AE,
subjectSample = 2
)
# filter based on specified variable/value:
# only adverse events possibly related
filterData(
data = dataAll$AE,
subsetVar = "AEREL",
subsetValue = "POSSIBLE"
)
# filter based on a different dataset:
# keep only adverse events for subjects in a specific treatment arm
filterData(
data = dataAll$AE,
subsetData = dataAll$DM,
subsetVar = "ACTARM",
subsetValue = "Placebo"
)
# filter based on subjects of interest
filterData(
data = dataAll$AE,
subjectSubset = c("01-701-1148", "01-701-1211")
)