Skip to contents

Write character partitions as separate Nexus files (for use in BEAUti)

Usage

write_partitioned_alignments(x, cluster_df, file)

Arguments

x

character data matrix as Nexus file (.nex) or data frame (with taxa as rows and characters as columns) read directly from local directory

cluster_df

cluster partitions as outputted by make.clusters

file

path to save the alignments. If file = "example.nex", alignments will be saved to files "example_part1.nex", "example_part2.nex", etc.

Value

no return value

Examples

# Load example phylogenetic data matrix
data("characters")

# Create distance matrix
Dmatrix <- get_gower_dist(characters)

# Find optimal partitioning scheme using PAM under k=3 partitions
cluster_df <- make_clusters(Dmatrix, k = 3)

# Write to Nexus files
if (FALSE) write_partitioned_alignments(characters, cluster_df, "example.nex")