# set up sample data (usually done by reading files)
mysamples <- c("ind1", "ind2", "ind3", "ind4")
myloci <- c("loc1", "loc2")
mygendata <- array(list(-9), dim=c(4,2), dimnames=list(mysamples, myloci))
mygendata[,"loc1"] <- list(c(202,204), c(204), c(200,206,208,212),
c(198,204,208))
mygendata[,"loc2"] <- list(c(78,81,84), c(75,90,93,96,99), c(87), c(-9))
mypopinfo <- c(1,2,1,2)
names(mypopinfo) <- mysamples
mypopnames <- c("this pop", "that pop")
# write an ATetra file
write.ATetra(mygendata, popinfo=mypopinfo, popnames=mypopnames,
commentline="sample data", file="atetratest.txt")
# view the file
cat(readLines("atetratest.txt"),sep="")
Run the code above in your browser using DataLab