View source: R/filterAndTidyRDBESDataObject.R
filterAndTidyRDBESDataObject | R Documentation |
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 TRUE
.
filterAndTidyRDBESDataObject(
RDBESDataObjectToFilterAndTidy,
fieldsToFilter,
valuesToFilter,
killOrphans = TRUE,
verbose = FALSE,
strict = TRUE
)
RDBESDataObjectToFilterAndTidy |
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 TRUE. |
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. |
The filtered input object of the same class as RDBESDataObjectToFilterAndTidy
.
## Not run:
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
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.