[R] Anyone have experience with kinship pedigree plot?
Hello, I am using the Kinship package to draw a pedigree plot. I am trying to control the spacing between individuals in the pedigree. Currently, it is drawing a pedigree with too little space, so the text is overlapping. I'd like to increase the distance between individuals. According to the documentation, I would expect the following to be relevant: http://rss.acs.unt.edu/Rdoc/library/kinship/html/plot.pedigree.html symbolsize controls symbolsize. Default=1. width default=8. For a packed pedigree, the minimum width allowed in the realignment of pedigrees. density defines density used in the symbols. Takes up to 4 different values. mar no comment(s) my pedigree command is similar to: plot(ptemp, width=5, symbolsize=1); however, 'width', doesnt seem to actually do anything as far as I can see (ie. the plot looks the same no matter what value I use). the example command in the kinship doc uses: plot(x, id=x$id, sex=x$sex, status=x$status, affected=x$affected, cex=1, col=rep(1, length(x$id)), symbolsize=1, branch=0.6, packed=T, align=packed, width=8, density=c(-1, 50,70,90), mar=c(4.1,1,4.1,1), angle=c(90, 70, 50, 0), keep.par=F, ...) when I try density params similar to their example, it also does not obviously do anything. I could not find documentation on exactly what those do either. does anyone have any experience with pedigree plots, other suggestions or tips on where else I should be looking? thanks for the help. -ben __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Basic graphs: something like groups, but where each plot has independent axis?
I am trying to graph weight data for our colony. We a data frame with Animal, Weight and Date. I'd like to display this data a series of simple xyplots. We only need to display these plots together, we do not need to make comparisons between animals. Each animal has been weighted over a different time period, so we do not want the same range for each X axis. Using the following, I can create one plot per animal: size - length(unique(data$id)) xyplot(weight ~ date | id, data=data, #type=o, layout=c(1,size), xlab=Date, ylab=Weight ); However, they share a common X axis. Is it possible to avoid this? In other words, I might want the first animal's plot to extend from 2008-01-01 through 2009-05-04, while the second plot extends from 2007-02-04 through 2010-01-01. Also, can I introduce more whitespace between each plot? Thank you for any help. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Pedigree / Identifying Immediate Family of Index Animal
I have a data frame containing the Id, Mother, Father and Sex from about 10,000 animals in our colony. I am interested in graphing simple family trees for a given subject or small number of subjects. The basic idea is: start with data frame from entire colony and list of index animals. I need to identify all immediate relatives of these index animals and plot the pedigree for them. We're not trying to do any sort of real analysis, just present a visualization of the family structure. I have used the kinship and pedigree packages to plot the pedigree. My question relates to efficiently identifying the animals to include in the pedigree: Starting with the data frame of ~10,000 records, I want to use a set of index animals to extract the immediate relatives and plot only a small number in the pedigree. 'Immediate relatives' is somewhat of an ambiguous term - I am currently defining it as 3 generations forward and 3 backward. Currently, I have a somewhat ugly approach where I recursively calculate each generation forward or backward and build a new dataframe. Is there a better approach or package that does this? I realize my code should be written better to get rid of the loops, so if anyone has suggestions there I would appreciate this as well. Thanks in advance. Code to calculate generations forward and backward: #queryIds holds the unique Ids for parents of the index animals queryIds = unique(c(ped$Sire, ped$Dam)); for(i in 1:gens){ if (length(queryIds) == 0){break}; #allPed is the dataframe with Id,Dam,Sire and Sex for animals in our colony newRows - subset(allPed, Id %in% queryIds); queryIds = c(newRows$Sire, newRows$Dam); ped - unique(rbind(newRows,ped)); } #build forwards #when calculating children, queryIds holds the Ids of the previous generation queryIds = unique(ped$Id); for(i in 1:gens){ if (length(queryIds)==0){break}; #allPed is the dataframe with Id,Dam,Sire and Sex for animals in our colony newRows - subset(allPed, Sire %in% queryIds | Dam %in% queryIds); queryIds = newRows$Id; ped - unique(rbind(newRows,ped)); } [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.