filterRDBESDataObject: Filter an RDBESDataObject

View source: R/filterRDBESDataObject.R

filterRDBESDataObjectR Documentation

Filter an RDBESDataObject

Description

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 RDBESDataObject to 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.

Details

killOrphans allows you to remove orphaned rows if set to TRUE. The default is FALSE.

Value

the filtered input object of the same class as RDBESDataObjectToFilter

Examples

## Not run: 

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
)

## End(Not run)

ices-tools-dev/icesRDBES documentation built on April 17, 2025, 1:58 p.m.