Learn R Programming

corHMM (version 1.22)

readNexusMorph: Reads morphological character data In NEXUS Format

Description

This function reads a file with character scoring in the NEXUS format and provides a properly formatted data set to input into the lewisMkv function.

Usage

readNexusMorph(file)

Arguments

file

a file name specified by either a variable of mode character, or a double-quoted string

Value

A data.frame of character scorings across sites for a set of species. Gaps and completely missing characters are coded as “?”, and “&” separate scorings of partially ambiguous characters. Will work as a direct input for “lewisMkv”.

Details

This parser is really just a hacked version of “read.nexus.data” that is provided by ape. I rewrote parts to deal with completely and incompletely ambiguous characters, gaps, and so that the format of the data fits perfectly into lewisMkv. As with “read.nexus.data” this parser reads data from a file written in a restricted NEXUS format. I've posted on my website (http://www.jeremybeaulieu.org/r.html) an example NEXUS file properly formatted that will work with this function. But there is one major change worth mentioning here:

  • Multistate characters ARE allowed. That is, NEXUS allows you to specify multiple character states at a character position either as an uncertainty or as an actual appearance of multiple states, {XY}. Examples: taxon 0011?110 --- OK! taxon 0011-110 --- OK! taxon 0011{01}110 --- OK! taxon 00?1{01}1-0 --- OK! taxon 0011(01)110 --- STILL NOT OK!