[R] Help with pedigree() function in kinship2

Jorge I Velez jorgeivanvelez at gmail.com
Tue May 12 12:59:52 CEST 2015


Dear R-help,

I am interested in plotting some pedigrees and came across the kinship2
package. What follows is an example of the pedigrees I am working with.

Now, when running

## check package availability
if(!require(kinship2)) install.packages('kinship2')
require(kinship2)


## data to plot
d <- structure(list(FamilyID = c("1", "1", "1", "1", "1", "1", "1",
"1", "1"), PatientID = structure(c(2L, 3L, 5L, 11L, 12L, 15L,
16L, 17L, 6L), .Label = c(" 1", " 2", " 3", " 4", " 5", " 6",
" 7", " 9", "10", "11", "13", "14", "18", "20", "23", "24", "25",
"27", "28", "29", "30", "31", "33", "34", "35", "37", "38", "39",
"41", "43", "45", "50", "62", "63", "64", "65", "66", "67", "85",
"88"), class = "factor"), FatherID = structure(c(1L, 1L, 6L,
1L, 5L, 6L, 1L, 7L, 6L), .Label = c("0", "1", "10", "11", "13",
"2", "23", "27", "28", "3", "33", "34", "35", "38", "5", "62",
"64", "66", "9"), class = "factor"), MotherID = structure(c(1L,
1L, 7L, 1L, 14L, 7L, 1L, 5L, 7L), .Label = c("0", "10", "18",
"2", "24", "29", "3", "30", "33", "34", "39", "4", "43", "5",
"6", "63", "65", "9"), class = "factor"), Sex = structure(c(2L,
1L, 1L, 2L, 2L, 2L, 1L, 2L, 2L), .Label = c("Female", "Male"), class =
"factor"),
    AffectionStatus = structure(c(1L, 1L, 2L, 1L, 2L, 2L, 1L,
    2L, 2L), .Label = c("1", "2"), class = "factor")), .Names =
c("FamilyID",
"PatientID", "FatherID", "MotherID", "Sex", "AffectionStatus"
), row.names = c(NA, 9L), class = "data.frame")

## plotting
ped <- with(d, pedigree(PatientID, FatherID, MotherID, Sex,  affected =
AffectionStatus, famid = FamilyID))

## Error in pedigree(PatientID, FatherID, MotherID, Sex, affected =
AffectionStatus,  :
##                    Value of 'dadid' not found in the id list 1/0 1/0 1/2
1/0 1/2

I get an error.  My sessionInfo() is at the end.  I was wondering if
someone could help me to dissect what the cause of this error is and how it
can be fixed.

Thank you very much for your help.

Best regards,
Jorge Velez.-


R> sessionInfo()
R version 3.2.0 Patched (2015-05-04 r68320)
Platform: x86_64-apple-darwin13.4.0 (64-bit)
Running under: OS X 10.10.3 (Yosemite)

locale:
[1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  parallel  compiler
 methods
[9] base

other attached packages:
[1] kinship2_1.6.0 quadprog_1.5-5 Matrix_1.2-0   readxl_0.1.0

loaded via a namespace (and not attached):
[1] Rcpp_0.11.6     grid_3.2.0      lattice_0.20-31

	[[alternative HTML version deleted]]



More information about the R-help mailing list