Export character partitions to a Nexus file
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.
cluster_dfobject; the output of a call to
The path of the text file to be created containing the partitioning information in Nexus format. If
NULL(the default), no file will be written and the output will be returned as a string. If
"", the text will be printed to the console. Passed directly to the
The text as a string, returned invisibly if
file is not
cat on the resulting output to format it correctly (i.e., to turn
"\n" into line breaks).
vignette("char-part") for the use of this function as part of an analysis pipeline.
# 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)