How to Calculate the Pairwise LD for the given data?

#1
Dear all,

I have the following data, which is the output from 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 R function to calculate the R-Square across pairs separated by <10% (the difference between positions of SNPs must be < 0.10) of the simulated genomic region.

I have search this from many days but still did not find how to do in R.
Could anyone help me in this regards?

Thanks in advance!
Regards,
Jacki