matrix.to.aln {ComPairWise}R Documentation

Convert a data matrix to an alignment

Description

This is the inverse of aln.to.matrix. It reads a character matrix and turns it into an alignment object.

Usage

matrix.to.aln(matrix)

Arguments

matrix A matrix of aligned data, usually but not necessarily DNA. If taxon names are the row names of the matrix, they will be preserved. If the matrix has no row names, the output taxon names will be NULL.

Value

~Describe the value returned An alignment object, whose elements are

nb Number of aligned sequences
nam Character vector of the names of the sequences (NULL if none included in the input matrix)
seq Character vector of the sequences
com currently always NA; could be a comment

Author(s)

TER

See Also

aln.to.matrix

Examples

## The function is currently defined as
function (matrix) 
{
    x <- unname(apply(matrix, 1, paste, collapse = ""))
    aln <- list(nb = nrow(matrix), nam = rownames(matrix), seq = x, 
        com = NA)
    class(aln) <- "alignment"
    return(aln)
  }

[Package ComPairWise version 1.01 Index]