WriteDendrogram {DECIPHER} | R Documentation

## Write a Dendrogram to Newick Format

### Description

Writes a dendrogram object to a file in Newick (also known as New Hampshire) parenthetic format.

### Usage

    WriteDendrogram(x,
                    file = "",
                    quoteLabels = TRUE,
                    convertBlanks = !quoteLabels,
                    internalLabels = TRUE,
                    digits = 10,
                    append = FALSE)

### Arguments

`x` | An object of class `dendrogram`.
`file` | A connection or a character string naming the file path where the tree should be exported. If "" (the default), the tree is printed to the standard output connection, the console unless redirected by sink.
`quoteLabels` | Logical specifying whether to place leaf labels in double quotes.
`convertBlanks` | Logical specifying whether to convert spaces in leaf labels to underscores.
`internalLabels` | Logical indicating whether to write any “edgetext” preceding a node as an internal node label.
`digits` | The maximum number of digits to print for edge lengths.
`append` | Logical indicating whether to append to an existing `file`. Only applicable if `file` is a character string. If `FALSE` (the default), then the file is overwritten.

### Details

`WriteDendrogram` will write a dendrogram object to a `file` in standard Newick format. Note that special characters (commas, square brackets, colons, semi-colons, and parentheses) present in leaf labels will likely cause a broken Newick file unless `quoteLabels` is `TRUE` (the default).

### Value

`NULL`.

### Author(s)

Erik Wright eswright@pitt.edu

### See Also

`IdClusters`, `ReadDendrogram`

### Examples

    dists <- matrix(c(0, 10, 20, 10, 0, 5, 20, 5, 0),
        nrow=3,
        dimnames=list(c("dog", "elephant", "horse")))
    dend <- IdClusters(dists, method="NJ", type="dendrogram")
    WriteDendrogram(dend)

[Package DECIPHER version 2.16.1 Index]