# Example inputs
geno_matrix <- matrix(
c(4, 1, 4, 0, # S1
2, 2, 1, 3, # S2
0, 4, 0, 4, # S3
3, 3, 2, 2, # S4
1, 4, 2, 3),# S5
nrow = 4, ncol = 5, byrow = FALSE, # individuals=rows, SNPs=cols
dimnames = list(paste0("Ind", 1:4), paste0("S", 1:5))
)
pop_list <- list(
PopA = c("Ind1", "Ind2"),
PopB = c("Ind3", "Ind4")
)
allele_freqs <- allele_freq_poly(geno = geno_matrix, populations = pop_list, ploidy = 4)
print(allele_freqs)
Run the code above in your browser using DataLab