How to calculate the pairwise LD for the given data? I have the following data, which is the output from the MS Hudson software. 
segsites: 6 
positions: 0.1256 0.3122 0.3218 0.4970 0.5951 0.7943 
001010 
110101 
010100 
001010 
010100 

I want to make an R function to calculate the R-Squared across pairs separated by <10% (the difference between positions of SNPs must be < 0.10) of the simulated genomic region. 
How would I go about doing this?
 A: There are various R/Bioconductor packages that allow you to compute pairwise correlation for SNPs in linkage disequilibrium, see the CRAN Task View Statistical Genetics. As I worked directly with whole genome scan, I've been mainly using snpMatrix, but LDheatmap or mapLD are fine. However, usually they expect genotype data (AA, AB, or BB), so I guess you will have to first convert your binary-encoded haplotype... About the filter on location, I also guess you just have to consider the pairwise $R^2$ or $D'$ for proximal SNPs (usually, we draw a so-called heatmap of pairwise LD, which is roughly speaking the lower-diag elements of the correlation matrix, so you just have to consider the very first off diagonal elements).
Update
Now that I've read some papers, I'm not sure you will achieve your goals with the aforementioned method. To my knowledge, few packages allow to cope with multiallelic loci or haplotype blocks, one example being the gap package from JH Zhao (see also a review in the Journal of Statistical Software). The LDkl() function for example computes D' and $\rho$ from a vector of haplotype frequencies, which can easily be plotted using image() or levelplot() from the lattice package.
