cluster_to_nexus {EvoPhylo} | R Documentation |
Export character partitions to a Nexus file
Description
Creates and exports a Nexus file with a list of characters and their respective partitions as inferred by the make_clusters
function. The contents can be copied and pasted directly into a Mr. Bayes commands block for a partitioned clock Bayesian inference analysis.
Usage
cluster_to_nexus(cluster_df, file = NULL)
Arguments
cluster_df |
A |
file |
The path of the text file to be created containing the partitioning information in Nexus format. If |
Value
The text as a string, returned invisibly if file
is not NULL
. Use cat
on the resulting output to format it correctly (i.e., to turn "\n"
into line breaks).
See Also
vignette("char-part")
for the use of this function as part of an analysis pipeline.
Examples
# See vignette("char-part") for how to use this
# function as part of an analysis pipeline
# 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 file and export to .txt file:
file <- tempfile(fileext = ".txt")
# You would set, e.g.,
# file <- "path/to/file.txt"
cluster_to_nexus(cluster_df, file = file)