**By Kevin Keenan**

` Error in if(pTotal == 0){ : missing value where TRUE/FALSE needed `

` if(pTotal == 0){ `

It turns out that this code contained the most obscure bug I've ever seen. It would only cause a problem under the most improbable conditions for microsatellite data from 'real' populations. Basically I was using the R function 'apply' to convert columns of a matrix into tables which list the number of occurrences of each allele at a particular locus. However for some reason if all tables generated using apply are the same length (i.e. all loci have the same number of alleles), the function will simplify the results to a matrix rather than the usual list of tables. This change in results format meant that all parameters calculated from this point on were wrong. Here's the code that caused the problem:

` afTab <- function(x){ `

apply(x, 2, table)

}

` afTab <- function(x){ `

lapply(x, function(i){

return(table(x[,i]))

})

}

Good stuff!