title: Pairwise Phi-st with ade4, mmod and adegenet or similar packages?
body: <p>I have a dataset with SNP frequencies per gene for a set of different haploid populations belonging to three different groups. I have performed an AMOVA and permutation test to test for the differentiation between groups using the ade4 package in r. However, I would like to have the pairwise Phi-st between populations. I have searched and there are some alternatives that calculate the Phi-st in packages like mmod, so far I have tried the following (This is just a toy data set to represent the structure, the original file is larger):</p>
  
  <pre><code>library(ade4)
  library(mmod)
  library(adegenet)
  
  data&lt;-data.frame(A=c("0","0","0","100","25","75"),B=c("0","88","15","0","0","0"),C=c("25","0","0","10","12","90"),X=c("100","80","0","0","0","0"),Y=c("73","20","12","0","0","0"),Z=c("50","100","15","10","0","0")) # Column=Gene
  
  row.names(data)&lt;-.genlab("population",6) # Rows=Populations
  # Convert the data frame to genind
  data2&lt;-df2genind(data,ploidy=1)
  # Calculate Ph-st
  Phi_st_Meirmans(data2)
  </code></pre>
  
  <p>But I get the following error</p>
  
  <pre><code>Error in within_dists/(as.numeric(pop.freqs) * 2) : non-numeric argument to binary operator
  </code></pre>
  
  <p>I have tried to find out how to better structure my data but I haven't been able to. </p>
  
  <p>Does anyone have a suggestion or an idea on how to do this in a more correct way?
  Thanks in advance!</p>