<html><body><div>That worked perfectly.. Thanks alot.</div><div><br></div><div>Ian<br><br>On Sep 28, 2012, at 09:17 AM, Pip Griffin <pip.griffin@gmail.com> wrote:<br><br></div><div><blockquote type="cite"><div class="msg-quote"><div class="_stretch">Hi Ian,<br> <br> Here is some code that should help:<br> <br> # This assumes your distance file is in a tab-delimited table format<br> # also that it has a header, and that the first column contains the<br> population names<br> # (or individual names, if you're looking at pairwise distances<br> between individuals).<br> <br> initialtable<-read.table("All Pops Pairwise Distance.txt", header=TRUE)<br> <br> # Getting the population names from Column 1<br> <br> popnames<-as.vector(initialtable[,1])<br> <br> # Converting your dataframe into a matrix<br> # nb exclude the column that contains the population names, you only<br> want the distances themselves<br> <br> initialmatrix<-as.matrix(initialtable[,2:ncol(initialtable)])<br> <br> # Giving your matrix some dimension names (the population names you<br> specified just before as a vector)<br> <br> dimnames(initialmatrix)<-list(popnames, popnames)<br> <br> #Specifying your matrix as a pairwise distance matrix<br> <br> distmatrix<-as.dist(initialmatrix)<br> <br> <br> Best of luck!<br> Pip Griffin<br> <br> <br> On Fri, Sep 28, 2012 at 1:52 AM, Ian Bradbury <<a href="mailto:ibradbur@me.com" data-mce-href="mailto:ibradbur@me.com">ibradbur@me.com</a>> wrote:<br> > Hi, I am working with a series of aquatic populations around an island. I am<br> > hoping to do IBD and other spatial analyses and trying to figure out how to<br> > deal with complex landscape structure. I can not just use the straight line<br> > distances and was considering using my own distance matrix but when I load a<br> > text file (either tab or csv) the format doesn't match. Any suggestions on<br> > how to load my own distance matrices (gen or geo) would be much appreciated.<br> > Thanks, Ian<br> ><br> ><br> > _______________________________________________<br> > adegenet-forum mailing list<br> > <a href="mailto:adegenet-forum@lists.r-forge.r-project.org" data-mce-href="mailto:adegenet-forum@lists.r-forge.r-project.org">adegenet-forum@lists.r-forge.r-project.org</a><br> > <a href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum" data-mce-href="https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum">https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/adegenet-forum</a><br></div></div></blockquote></div></body></html>