The returned object will include all rows which either: a) do not included
any of the field names in fieldsToFilter, or b) do include the field names
and have one of the allowed values in valuesToFilter.
If you want to filter for a id field like DEid, FTid etc, the filtering
works only on the table where the id field is its key. For example, if you
try to filter on FOid it does not look FOid in other tables like FT,
although the field FOid exists in FT table.
Usage
filterRDBESDataObject(
RDBESDataObjectToFilter,
fieldsToFilter,
valuesToFilter,
killOrphans = FALSE,
verbose = FALSE,
strict = TRUE
)Arguments
- RDBESDataObjectToFilter
The
RDBESDataObjectto filter- fieldsToFilter
A vector of the field names you wish to check
- valuesToFilter
A vector of the field values you wish to filter for
- killOrphans
Controls if orphan rows are removed. Default is
FALSE.- verbose
(Optional) Set to TRUE if you want informative text printed out, or FALSE if you don't. The default is FALSE.
- strict
(Optional) This function validates its input data - should the validation be strict? The default is TRUE.
Examples
if (FALSE) { # \dontrun{
myH1RawObject <-
importRDBESDataCSV(rdbesExtractPath = "tests\\testthat\\h1_v_1_19")
myFields <- c("SDctry", "VDctry", "VDflgCtry", "FTarvLoc")
myValues <- c("ZW", "ZWBZH", "ZWVFA")
myFilteredObject <- filterRDBESDataObject(myH1RawObject,
fieldsToFilter = myFields,
valuesToFilter = myValues
)
# Inverse filtering (exclude certain values)
# Example: keep all DE rows except those with DEid in `excludedValues`
# Compute the complement of the excluded set using setdiff
allValues <- unique(myH1RawObject$DE$DEid)
excludedValues <- c(5351)
myInverseFiltered <- filterRDBESDataObject(
myH1RawObject,
fieldsToFilter = "DEid",
valuesToFilter = setdiff(allValues, excludedValues)
)
} # }