Ensure parents are sufficiently older than offspring
checkParentAge(sb, minParentAge = 2, reportErrors = FALSE)
sb | A dataframe containing a table of pedigree and demographic information. |
---|---|
minParentAge | numeric values to set the minimum age in years for an animal to have an offspring. Defaults to 2 years. The check is not performed for animals with missing birth dates. |
reportErrors | logical value if TRUE will scan the entire file and make a list of all errors found. The errors will be returned in a list of list where each sublist is a type of error found. |
A dataframe containing rows for each animal where one or more
parent was less than minParentAge
. It contains all of the columns
in the original sb
dataframe with the following added columns:
sireBirth sire's birth date
sireAge age of sire in years on the date indicated by birth
.
damBirth dam's birth date
damAge
age of dam in years on the date indicated by birth
.
# \donttest{ library(nprcgenekeepr) qcPed <- nprcgenekeepr::qcPed checkParentAge(qcPed, minParentAge = 2)#> [1] dam sire id sex gen birth exit #> [8] age sireBirth damBirth sireAge damAge #> <0 rows> (or 0-length row.names)checkParentAge(qcPed, minParentAge = 3)#> [1] dam sire id sex gen birth exit #> [8] age sireBirth damBirth sireAge damAge #> <0 rows> (or 0-length row.names)checkParentAge(qcPed, minParentAge = 5)#> dam sire id sex gen birth exit age sireBirth damBirth #> 63 EX98QB UAJJG4 L8Q55X F 2 1993-09-23 2007-05-16 13.6 <NA> 1989-02-18 #> sireAge damAge #> 63 NA 4.59checkParentAge(qcPed, minParentAge = 6)#> dam sire id sex gen birth exit age sireBirth #> 63 EX98QB UAJJG4 L8Q55X F 2 1993-09-23 2007-05-16 13.6 <NA> #> 90 L42X7I ULYO4W BA0JYM F 2 2004-02-29 <NA> 15.3 <NA> #> 98 MRGPPA U7F4QJ JUMNN0 F 3 1993-12-31 2008-04-30 14.3 <NA> #> 102 O4Z4IB UYLDPW HFEQNK F 2 1996-03-20 2017-02-04 20.9 <NA> #> 125 RY6OPR 549AEC 80EOVS F 3 2005-12-10 <NA> 13.5 1998-09-27 #> 156 ZYTIYY UP4NEJ E5BLUE F 1 1980-08-22 1998-11-18 18.2 <NA> #> damBirth sireAge damAge #> 63 1989-02-18 NA 4.59 #> 90 1998-09-17 NA 5.45 #> 98 1988-03-19 NA 5.79 #> 102 1990-08-29 NA 5.56 #> 125 2000-02-29 7.2 5.78 #> 156 1974-12-21 NA 5.67checkParentAge(qcPed, minParentAge = 10)#> dam sire id sex gen birth exit age sireBirth #> 1 0DXI08 HRQJQR G6P0W4 F 1 1979-02-02 2000-04-15 21.2 1969-12-04 #> 2 0RV8OM QBLTI6 8IJUQO F 3 1999-02-03 2017-04-27 18.2 1987-12-27 #> 11 3CQZ3E U0M96T MRGPPA F 2 1988-03-19 2008-03-20 20.0 <NA> #> 12 3O7TMT 5EP5AL L6D4ZC M 2 1988-06-25 2009-04-10 20.8 1976-09-30 #> 13 43TUN9 L6D4ZC AXDMJM F 3 1999-11-09 <NA> 19.6 1988-06-25 #> 15 4WB10I 5EP5AL DO4NKS M 2 1991-08-04 2013-02-08 21.5 1976-09-30 #> 16 596J7E UKK94T 6MIRJI F 1 1977-05-20 1996-05-06 19.0 <NA> #> 17 5I9OO3 MPR81X INGWI7 F 5 2015-10-24 <NA> 3.7 1997-02-17 #> 19 67RZLW HBEMKY KCOUSL F 3 2002-11-12 2017-05-05 14.5 1995-03-21 #> 20 6EBYMM YRCQFO 8KM1MP F 5 2013-05-22 <NA> 6.1 1994-04-30 #> 21 6EJ6RI 0RZ5LL MPAZXU F 1 1978-04-03 2005-06-27 27.2 1971-01-05 #> 23 6IPOZK HRQJQR ZLPSUH M 2 1988-12-06 2008-12-12 20.0 1969-12-04 #> 24 6MIRJI F0YSEE QBLTI6 M 2 1987-12-27 2002-07-15 14.5 1980-10-16 #> 27 6OL4PZ UMSQ78 HN5YTI F 2 1989-11-09 2008-10-26 19.0 <NA> #> 30 80EOVS MPR81X EUG3WE F 4 2015-01-22 <NA> 4.4 1997-02-17 #> 32 82IE3M QBLTI6 CN4GMN M 3 1999-08-24 <NA> 19.8 1987-12-27 #> 36 95U2JO HP3E04 0DAV0I M 4 2014-10-23 <NA> 4.7 2007-03-24 #> 37 9AZMHA 716P7O RJI1ET F 1 1982-03-24 2002-09-19 20.5 1975-01-30 #> 41 9UAWP7 1MDPFZ 309VM2 F 4 2016-05-19 <NA> 3.1 1998-12-12 #> 46 AXDMJM WMUJC5 HLI95R F 4 2015-01-14 <NA> 4.4 2006-07-24 #> 47 BA0JYM BCSR2N 2KULR3 F 3 2013-06-18 <NA> 6.0 1995-06-06 #> 51 BRLQFI DZ3B9K BNMWNZ F 4 1999-10-01 2014-07-25 14.8 1988-10-27 #> 52 BVFJGE UPR4NB V5L8XH F 2 1993-06-06 2008-10-16 15.4 <NA> #> 54 CJ49U3 TNAWBK 1MDPFZ M 3 1998-12-12 <NA> 20.5 1989-03-10 #> 56 CNPGS5 9Z9TIJ L8SZ2V F 1 1979-06-12 1998-10-25 19.4 1965-12-18 #> 58 CV1SHY 4UTH8P 2IXJ2N F 4 2013-05-21 <NA> 6.1 1998-11-15 #> 63 EX98QB UAJJG4 L8Q55X F 2 1993-09-23 2007-05-16 13.6 <NA> #> 64 F50D26 HRQJQR 6IPOZK F 1 1979-02-09 2005-06-03 26.3 1969-12-04 #> 69 GJ39EY QDY8I7 4KWUTK M 2 1986-04-01 2006-06-20 20.2 1979-02-07 #> 70 HAQR9N V8VU31 RI0O7F F 3 2015-01-09 <NA> 4.4 2005-03-27 #> 71 HFEQNK V8VU31 170ZTZ F 3 2015-02-07 <NA> 4.4 2005-03-27 #> 73 HN5YTI U2Y0HA 2ENDCF F 3 1999-05-05 2017-07-28 18.2 <NA> #> 79 JPKPJC UA2A8P HBEMKY M 2 1995-03-21 2013-10-15 18.6 <NA> #> 83 K0M40I QDY8I7 NQ91B2 F 2 1989-09-22 2010-01-11 20.3 1979-02-07 #> 84 K7QBLH ZWBMTP H00H7D M 2 1996-12-03 2011-02-20 14.2 1978-07-11 #> 89 KY0D3C UYNXK3 48YAZ5 M 3 1998-11-29 2008-10-11 9.9 <NA> #> 90 L42X7I ULYO4W BA0JYM F 2 2004-02-29 <NA> 15.3 <NA> #> 95 MBJMH1 UONB0Y 3CQZ3E F 1 1981-09-22 2001-11-04 20.1 <NA> #> 96 MF8X1C WMUJC5 JGPN6K F 4 2013-07-02 <NA> 6.0 2006-07-24 #> 98 MRGPPA U7F4QJ JUMNN0 F 3 1993-12-31 2008-04-30 14.3 <NA> #> 100 NQ91B2 QDY8I7 MPR81X M 3 1997-02-17 2016-08-17 19.5 1979-02-07 #> 101 NY9FEC H00H7D WMUJC5 M 3 2006-07-24 <NA> 12.9 1996-12-03 #> 102 O4Z4IB UYLDPW HFEQNK F 2 1996-03-20 2017-02-04 20.9 <NA> #> 107 OY032S YIAD2N Z4HGIR F 3 1999-05-07 2016-11-01 17.5 1991-03-11 #> 108 P4CQ2T HRBVOE 168Q0A M 1 1978-10-29 1993-09-15 14.9 1970-12-04 #> 111 PU7JEL HRBVOE QR5CMP M 2 1985-02-16 2001-01-13 15.9 1970-12-04 #> 115 Q444GQ MPR81X DD1U77 F 4 2014-03-31 <NA> 5.2 1997-02-17 #> 117 R34BVI 48YAZ5 6EBYMM F 4 2005-12-26 <NA> 13.5 1998-11-29 #> 118 RD6KMA HRBVOE OTAC9O F 1 1979-12-18 2002-01-25 22.1 1970-12-04 #> 119 RD6KMA HRBVOE ZWBMTP M 1 1978-07-11 1999-02-23 20.6 1970-12-04 #> 121 RRWDL5 V8VU31 7M51X5 F 3 2015-01-30 <NA> 4.4 2005-03-27 #> 123 RTTX6H YIAD2N J3D3N5 M 3 2001-01-25 <NA> 18.4 1991-03-11 #> 124 RX08B3 CQMWGX DZ3B9K M 3 1988-10-27 2007-06-30 18.7 1979-05-15 #> 125 RY6OPR 549AEC 80EOVS F 3 2005-12-10 <NA> 13.5 1998-09-27 #> 126 S8IEHH H0UP6R 2YGWN0 M 3 1998-03-03 2017-06-15 19.3 1989-01-08 #> 127 SAAU6D V8VU31 DR5GXB F 4 2015-02-23 <NA> 4.3 2005-03-27 #> 133 TWWT1N ODSV6N QDY8I7 M 1 1979-02-07 1999-01-04 19.9 1970-01-08 #> 138 WHKS5E IZ0ELE CV1SHY F 3 2006-04-24 <NA> 13.2 1999-05-30 #> 141 XHP9KQ HRQJQR AD0UE1 F 1 1978-12-12 2005-03-15 26.3 1969-12-04 #> 144 Y5QZ1U UHR4CA 8Q43EX F 1 1990-02-04 2004-07-02 14.4 <NA> #> 146 YHI773 C09A7K TNAWBK M 2 1989-03-10 2006-07-26 17.4 1972-12-25 #> 152 ZQ0DRX ONA6E5 GJ39EY F 1 1977-05-02 2003-02-11 25.8 1964-12-05 #> 155 ZXJQQ5 MQB1AE JNWPY2 F 1 1979-09-24 2002-09-03 22.9 1969-01-30 #> 156 ZYTIYY UP4NEJ E5BLUE F 1 1980-08-22 1998-11-18 18.2 <NA> #> damBirth sireAge damAge #> 1 1965-01-04 9.16 14.08 #> 2 1992-06-22 11.10 6.62 #> 11 1981-09-22 NA 6.49 #> 12 1981-09-15 11.73 6.78 #> 13 1990-07-14 11.37 9.32 #> 15 1982-03-30 14.84 9.35 #> 16 1968-12-21 NA 8.41 #> 17 2007-10-21 18.68 8.01 #> 19 1990-07-21 7.65 12.31 #> 20 2005-12-26 19.06 7.40 #> 21 1964-12-02 7.24 13.33 #> 23 1979-02-09 19.01 9.82 #> 24 1977-05-20 7.20 10.60 #> 27 1982-07-13 NA 7.33 #> 30 2005-12-10 17.93 9.12 #> 32 1991-01-15 11.66 8.61 #> 36 2002-12-10 7.58 11.87 #> 37 1970-01-15 7.15 12.19 #> 41 2006-05-23 17.43 9.99 #> 46 1999-11-09 8.48 15.18 #> 47 2004-02-29 18.03 9.30 #> 51 1991-12-31 10.93 7.75 #> 52 1986-12-08 NA 6.49 #> 54 1987-04-06 9.76 11.69 #> 56 1969-12-11 13.48 9.50 #> 58 2006-04-24 14.51 7.07 #> 63 1989-02-18 NA 4.59 #> 64 1969-01-21 9.18 10.05 #> 69 1977-05-02 7.15 8.91 #> 70 1999-10-12 9.79 15.24 #> 71 1996-03-20 9.87 18.89 #> 73 1989-11-09 NA 9.48 #> 79 1986-03-07 NA 9.04 #> 83 1979-11-17 10.62 9.85 #> 84 1989-03-06 18.40 7.75 #> 89 1992-09-14 NA 6.21 #> 90 1998-09-17 NA 5.45 #> 95 1975-01-23 NA 6.66 #> 96 2000-02-08 6.94 13.40 #> 98 1988-03-19 NA 5.79 #> 100 1989-09-22 18.03 7.41 #> 101 1995-02-06 9.64 11.46 #> 102 1990-08-29 NA 5.56 #> 107 1984-09-27 8.16 14.61 #> 108 1968-01-20 7.90 10.77 #> 111 1978-03-04 14.20 6.96 #> 115 2004-10-08 17.11 9.48 #> 117 1992-12-12 7.07 13.04 #> 118 1968-12-13 9.04 11.01 #> 119 1968-12-13 7.60 9.57 #> 121 1994-12-25 9.85 20.10 #> 123 1989-01-23 9.88 12.01 #> 124 1980-07-11 9.45 8.30 #> 125 2000-02-29 7.20 5.78 #> 126 1989-11-24 9.15 8.27 #> 127 2005-02-15 9.91 10.02 #> 133 <NA> 9.08 NA #> 138 1990-11-24 6.90 15.41 #> 141 1970-01-04 9.02 8.94 #> 144 1983-12-11 NA 6.15 #> 146 1980-03-18 16.21 8.98 #> 152 1968-01-09 12.41 9.31 #> 155 1970-01-03 10.65 9.72 #> 156 1974-12-21 NA 5.67# }