# data frame of sample information. No factors!
dat <- data.frame(family=c(1,1,1,1,2,2,2), offspring=c("a","a","b","c","d","e","f"),
father=c("b","b",0,0,"e",0,0), mother=c("c","c",0,0,"f",0,0),
sex=c("M","M","M","F","F","M","F"), scanID=1:7,
stringsAsFactors=FALSE)
dat
men.list <- mendelList(dat$family, dat$offspring, dat$father, dat$mother,
dat$sex, dat$scanID)
men.list
# If fathers and mothers do not have separate entries in each vector,
# mendelList returns a "NULL":
dat <- dat[c(1,5),]
dat
mendelList(dat$family, dat$offspring, dat$father, dat$mother,
dat$sex, dat$scanID)
men.df <- mendelListAsDataFrame(men.list)
men.df
Run the code above in your browser using DataLab