View source: R/functions_pool.R
splitMatrix | R Documentation |
This function splits a matrix into different list entries. The matrix is
split according to a set of row indexes defined by the size
input.
splitMatrix(matrix, size)
matrix |
is obviously a matrix, ideally one containing genotypes. Each column of the matrix should be a different site and each row a different individual. |
size |
a list with one entry per population. Each entry should be a vector containing the size (in number of diploid individuals) of each pool. Thus, if a population was sequenced using a single pool, the vector should contain only one entry. If a population was sequenced using two pools, each with 10 individuals, this vector should contain two entries and both will be 10. |
The size
input is utilized to create the index of the rows that go into the
different list entries. It specifies the size, in terms of number of
individuals, of each population.
a list with one entry per entry of the size input argument. Each entry contains the information of the original matrix for the number of individuals specified by the corresponding entry of the size input argument.
set.seed(10)
# create a random matrix
mymatrix <- matrix(round(runif(n = 50, min = 10, max = 25)), nrow = 10)
# split that matrix assuming 8 individuals in the first population and two in the second
splitMatrix(matrix = mymatrix, size = list(8, 2))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.