To perform a Mantel's Matrix correlation in R you can use library ade4. You pecify two distance matrices and the number of permutations you want performed
> install.packages("ade4") > library(ade4) > mantel.rtest(station.dists, ozone.dists, nrepet = 9999)