EmbiggenMatrix: Embiggen a cladistic matrix

Description Usage Arguments Details Value Author(s) Examples

View source: R/EmbiggenMatrix.R

Description

Given a cladistic matrix, will duplicate each block of characters N times.

Usage

1
EmbiggenMatrix(CladisticMatrix, N)

Arguments

CladisticMatrix

A cladistic matrix in the format imported by Claddis::read_nexus_matrix.

N

The number of times to duplicate the data.

Details

Given a cladistic matrix in the format imported by Claddis::read_nexus_matrix will duplicate each block N times. Thus if a block contains 10 characters and N is 5 the resulting block will have 50 characters total.

This function exists for internal use in the Metatree function as a means of upweighting MRP data beyond the limits of TNT (maximum weight 1000) by duplicating blocks. However, it is also made available for individual use here.

Value

A cladistic matrix in the format imported by Claddis::read_nexus_matrix.

Author(s)

Graeme T. Lloyd graemetlloyd@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Build an example matrix of six species and four characters:
ExampleMatrix <- Claddis::build_cladistic_matrix(matrix(as.character(c(0, 0,
  0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)),
  nrow = 6, dimnames = list(LETTERS[1:6], c()), byrow = TRUE))

# Inspect starting matrix:
ExampleMatrix$matrix_1$matrix

# Duplicate block five times (20 characters):
ExampleMatrix <- EmbiggenMatrix(ExampleMatrix, 5)

# Inspect matrix to check it now contains 20 characters:
ExampleMatrix$matrix_1$matrix

graemetlloyd/metatree documentation built on April 29, 2021, 2:32 a.m.