#### Deifine hierarchical structure for genetic data
Str=function(nreg,r,npops){
Str=data.frame(matrix(data=0,ncol=npops, nrow=3)) #
Str[1,]=c(rep("ecosystem",times=npops))
# Str[2,]=c(rep(paste0("region",1:nreg),each=(npops/nreg)))
#r=vector(r) # eg. c(r1,r2,r3,r4) number of elements should be equal to nreg
if (length(r)!= nreg) stop("number of regions should be equal to the number of r defined")
Str[2,]=c(rep(paste0("region",1:nreg),r))
Str[3,]=c(paste("pop",1:npops))
Str=as.matrix(Str)
return(Str)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.