Checks that the Id, SId, and DId columns of a dataframe are valid for function dmm().

Description

Checks that Id's form an arithmetic sequence, and that every SId and DId appears as an Id.This ensures that relationship matrix construction can proceed without error. Also checks each SId is a male, and each DId is a female

Usage

1

Arguments

df

A dataframe containing the columns Id, SId, and DId as required to include pedigree information.

Details

Function pedcheck() would normally be used before function mdf(), to indicate whether mdf() is needed. If there are base animals missing from the dataframe, it will report errors. It can be used after mdf() just to check for errors in the Sex of individuals. Errors in the Sex of individuals can affect calculation of sexlinked relationship matrices.

Both the inline code in function dmm() and the routines in package nadiv require Id's in a numerical sequence and base animals present, for correct relationship matrix calculations.

Value

Returns zero if the dataframe passes check tests. Returns number of message(s) if the dataframe fails check tests, and prints the messages.

Note

Function pedcheck() is an internal function called by function dmm(). It is made available because it may be useful for preliminary checking.

Author(s)

Neville Jackson

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
library(dmm)
data(dt8bal.df)
pedcheck(dt8bal.df)
# this one returns 
#[1] 0
# which is a pass
## Not run: 
data(sheep.df)
pedcheck(sheep.df)
# this one returns 
#Id's must start at 1:
#Id's must be an arithmetic sequence:
#Id's must be unique:
#DId's must occur as an Id in the dataframe:
#All DId's must be female:
#[1] 5
# which is a fail

## End(Not run)
rm(dt8bal.df)

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.