R/filterAndTidyRDBESDataObject.R
filterAndTidyRDBESDataObject.Rd
This function filters an RDBESDataObject based on specified fields and values, and can optionally remove any orphan records.
The returned object will include all rows which either: a) do not include any of the field names in fieldsToFilter
, or b) do include the field names and have one of the allowed values in valuesToFilter
.
If killOrphans
is set to TRUE
, the function will remove orphaned rows. The default is FALSE
.
filterAndTidyRDBESDataObject(
RDBESDataObjectToFilterAndTidy,
fieldsToFilter,
valuesToFilter,
killOrphans = FALSE,
verboseOrphans = FALSE,
verboseBrokenVesselLinks = FALSE
)
The RDBESDataObject to filter.
A vector of the field names you wish to check.
A vector of the field values you wish to filter for.
Controls if orphan rows are removed. Default is FALSE
.
Controls if verbose output for orphan rows is printed. Default is FALSE
.
Controls if verbose output for broken vessel links is printed. Default is FALSE
.
The filtered input object of the same class as RDBESDataObjectToFilterAndTidy
.
if (FALSE) {
myH1RawObject <- createRDBESDataObject(rdbesExtractPath = "tests\\testthat\\h1_v_1_19_13")
# To check how removeBrokenVesselLinks() works
myH1RawObject$VD$VDlenCat[which(myH1RawObject$VD$VDencrVessCode=="VDcode_10")] <- "VL40XX"
myFields <- c("VSencrVessCode", "VDlenCat")
myValues <- c("VDcode_1","VDcode_2", "VDcode_10","VL1518","VL2440")
myFilteredObject <- filterAndTidyRDBESDataObject(myH1RawObject,
fieldsToFilter = myFields,
valuesToFilter = myValues,
killOrphans = TRUE, verboseBrokenVesselLinks = TRUE
)
}