findAndKillOrphans: This function finds and removed any orphan records in an...

View source: R/findAndKillOrphans.R

findAndKillOrphansR Documentation

This function finds and removed any orphan records in an RDBESDataObject. Normally data that has been downloaded from the RDBES will not contain orphan records - however if the data is subsequently filtered it is possible to introduce orphan records.

Description

This function finds and removed any orphan records in an RDBESDataObject. Normally data that has been downloaded from the RDBES will not contain orphan records - however if the data is subsequently filtered it is possible to introduce orphan records.

Usage

findAndKillOrphans(objectToCheck, verbose = FALSE, strict = TRUE)

Arguments

objectToCheck

an RDBESDataObject.

verbose

(Optional) If set to TRUE more detailed text will be printed out by the function. Default is FALSE.

strict

(Optional) This function validates its input data - should the validation be strict? The default is TRUE.

Value

an RDBESDataObject with any orphan records removed

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 )
myObjectNoOrphans <- findAndKillOrphans(objectToCheck = myFilteredObject,
                                       verbose = FALSE)

## End(Not run)

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