A package to draw pedigree charts using ggplot2 and kinship2.
if (!requireNamespace("remotes", quietly = TRUE)){
install.packages("remotes")
}
remotes::install_github("moritzlindner/ggped")
This Package contains a set of functions and geoms to draw pedigree charts from pedigree data created with kinship2.
```{r Example1, eval=TRUE, include=TRUE} require(ggped) data(minnbreast)
bpeds <- with(minnbreast, pedigree(id, fatherid, motherid, sex, affected=proband, famid=famid))
bped.id8 <- bpeds['8']
rel8 <- data.frame(id1=c(139,137), id2=c(140,138), code=c(1,2)) bped.id8 <- with(minnbreast[minnbreast$famid==8,], pedigree(id, fatherid, motherid, sex, affected=proband, relation=rel8))
bped.id8$mindex[bped.id8$id==159]<-bped.id8$mindex[bped.id8$id==149] bped.id8$findex[bped.id8$id==159]<-bped.id8$findex[bped.id8$id==149]
df<-dfalign.pedigree(bped.id8)
cartesian<-ggdraw.pedigree(dat=df,features = c("affected"))
cartesian
cartesian+ scale_x_continuous(expand=expansion(add = 0.25))+ scale_y_reverse(expand=expansion(add = 1))+ coord_polar() ```
Developed by Moritz Lindner
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.