(This article was first published on

**Gregor Gorjanc (gg)**, and kindly contributed to R-bloggers)I have previously provided sort of an overview about plotting the pedigrees, then specifically using the Graphiviz, while I have lately used the TikZ LaTeX (see slides 11-15) system (see more example). The later gives great (beautiful) results, but at the cost of writing TikZ code – it is not that horible, just time consuming – the same applies to Graphviz. Is there a quick way to plot a pedigree if we already have the data in the file. It is possible to do it in R using the kinship package. Here is an example:

ped <- data.frame( id=c( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11),

fid=c( 0, 0, 0, 3, 3, 5, 3, 6, 6, 0, 9),mid=c( 0, 0, 0, 2, 1, 4, 4, 7, 7, 0, 10),sex=c( 2, 2, 1, 2, 1, 1, 2, 1, 1, 2, 2),aff=0)ped[11, “aff”] <- 1library(package=”kinship”)ped <- with(ped, pedigree(id=id, dadid=fid, momid=mid, sex=sex, affected=aff))plot(ped)

Which gives the following result. It is not great, but it is informative and easy to do. From a practical point of implementation all pedigree members need to have both parents known or no parents known.

To

**leave a comment**for the author, please follow the link and comment on their blog:**Gregor Gorjanc (gg)**.R-bloggers.com offers

**daily e-mail updates**about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...