make.binary | R Documentation |
Convert a matrix of characters into a binary matrix by removing all columns that do not contain characters in exactly 2 states.
make.binary(dat, binChars = strsplit("ACDEFGHIKLMNPQRSTVWY", "")[[1]], extras = c("-"))
dat |
A matrix of characters. |
binChars |
An optional vector of all acceptable characters to represent a state in the binary matrix. |
extras |
An optional vector of all other acceptable characters which can be present in the binary matrix. These will not be counted towards one state or another. |
The default for binChars is all c('A','C','D','E','F','G','H','I','K','L','M','N','P','Q','R','S','T','V','W','Y')
, the IUPAC one-letter abbreviations for amino acids.
The default for extras is c('-')
, the symbol for a gap in an alignment.
This function works by requiring that each column in a matrix have exactly two character states that have been listed as acceptable in binChars
, or an acceptable non-state listed in extras
. It removes all columns that do not fit these criteria and returns the resulting matrix.
The converted character binary matrix.
Kasey Pham and Andrew Hipp
fas2bin
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.