Description Usage Arguments Value Author(s) Examples
View source: R/read.structure.R
Read a data file formatted as input for ‘Structure’
1 | read.structure(file, suffix = c("A", "B"))
|
file |
file name. |
suffix |
suffix to be attached to column names containing homologous alleles. |
A data.frame
, where rows represent individuals. The first column
patch
gives the patch number, and the remaining columns contain integer
allele values.
Kamil Bartoń
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #read example file:
dat <- read.structure(system.file(package = "ibmpm", "examples", "structure.txt"))
# infer sex from rownames
dat$sex <- factor(gsub("^.*([MF])[0-9]+$", "\\1", rownames(dat), perl = TRUE),
levels = c("F", "M"))
head(dat)
n.patch <- max(dat$patch)
# random dispersal matrix
disp.mat <- array(runif(n.patch^2), dim = c(n.patch, n.patch))
dat <- metapop(disp.mat, dat, sim.len = 20, n.offspring = 5, carr.cap = 100)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.