Learn R Programming

Claddis (version 0.7.0)

align_matrix_block: Aligns a phylogenetic matrix block

Description

Given a block of taxa and characters aligns text so each character block begins at same point.

Usage

align_matrix_block(matrix_block)

Value

Nothing is returned, instead the aligned block is sent to the clipboard ready for pasting into a text editor.

Arguments

matrix_block

The matrix block as raw input text.

Author

Graeme T. Lloyd graemetlloyd@gmail.com

Details

The function serves to help build NEXUS files by neatly aligning raw text blocks of taxa and characters. Or in simple terms it takes input that looks like this:

Allosaurus  012100?1011
Abelisaurus  0100???0000
Tyrannosaurus  01012012010
Yi  10101?0????

And turns it into something that looks like this:

Allosaurus     012100?1011
Abelisaurus    0100???0000
Tyrannosaurus  01012012010
Yi             10101?0????

I use this in building the NEXUS files on my site, graemetlloyd.com.

Examples

Run this code

# Build example block from above:
x <- paste(c(
  "Allosaurus  012100?1011",
  "Abelisaurus  0100???0000",
  "Tyrannosaurus  01012012010",
  "Yi  10101?0????"
), collapse = "\n")

# Look at block pre-alignment:
x

# Align block and place on clipboard:
if (FALSE) {
align_matrix_block(x)
}

# To test the response open a text editor and paste the
# contents of the clipboard.

Run the code above in your browser using DataLab