Part of Pedigree Curation
Arguments
- ped
dataframe that is the
Pedigree. It contains pedigree information. TheidandrecordStatuscolumns are required.- reportErrors
logical value if TRUE the function returns a character vector of duplicate
idvalues (orNULLwhen none are found) instead of the de-duplicated pedigree. Only records whoserecordStatusis"added"(the records made for parents that have no record of their own) are left out of the search; a record with any otherrecordStatus, includingNAor a blank, is a real animal and is searched.
Value
When reportErrors is FALSE, a dataframe (the
Pedigree) with duplicate rows removed; when reportErrors is
TRUE, a character vector of duplicate id values, one entry
for each extra occurrence of an id (or NULL when none are
found).
Details
Returns an updated dataframe with duplicate rows removed.
Returns an error if the table has duplicate IDs with differing data. The
error applies only when reportErrors is FALSE. Rows are
compared on all columns, including recordStatus.
Examples
ped <- nprcgenekeepr::smallPed
newPed <- cbind(ped, recordStatus = rep("original", nrow(ped)))
ped1 <- removeDuplicates(newPed)
nrow(newPed)
#> [1] 17
nrow(ped1)
#> [1] 17
pedWithDups <- rbind(newPed, newPed[1:3, ])
ped2 <- removeDuplicates(pedWithDups)
nrow(pedWithDups)
#> [1] 20
nrow(ped2)
#> [1] 17
