Learn R Programming

sidier (version 4.1.1)

HapPerPop: Returns the number of haplotypes per population.

Description

Given a two column matrix, this function returns the number of haplotypes per population (weighted matrix) and the presence/absence of haplotypes per population (interaction matrix). The input matrix must contain one row per individual. The first column must contain the population name, while the second must contain the name of the haplotypes. This input matrix can be obtained using the "FindHaplo" function.

Usage

HapPerPop(inputFile = NA, sep = " ", input = NA, header = FALSE,
NameIniPopulations = NA, NameEndPopulations = NA, saveFile = TRUE,
Wname = NA, Iname = NA)

Value

A list containing two matrices:

Weighted

The first matrix (named weighted matrix) contains the abundance of each haplotype per population, represented by the number of haplotypes (columns) found per population (rows).

Interaction

The second matrix (named interaction matrix) contains information about the presence or absence of each haplotype (columns) per population (rows) represented by 1 or 0, respectively.

Arguments

inputFile

the name of the file containing the two columns input matrix. Alternatively you can provide the name of a matrix stored in memory using the "input" option.

sep

the character separating columns in the input matrix (space, by default).

input

the two columns input matrix stored in memory. Alternatively you can provide the name of the file containing the input matrix using the "inputFile" option.

header

a logical value indicating whether the input matrix contains the names of the variables as its first line. (Default=FALSE).

NameIniPopulations

Position within the input matrix rownames of the initial character referring population name. This option is useful if names contained in the first column includes more information than the population name (e.g., marker name, individual details...).

NameEndPopulations

Position within the input matrix rownames of the last character referring population name. This option is useful if names contained in the first column includes more information than the population name (e.g., marker name, individual details...).

saveFile

a logical; if TRUE (default), the two ouput matrices computed are saved as two different text files.

Wname

the name given to the output weighted matrix file.

Iname

the name given to the output interaction matrix file

Author

A. J. Muñoz-Pajares

Details

If both NameIniPopulations and NameEndPopulations are not defined, the names contained in the input matrix first column are used as population identifiers.

See Also

FindHaplo