R: Writing and reading distances in phylip and nexus format

writeDist {phangorn} | R Documentation

## Writing and reading distances in phylip and nexus format

### Description

`readDist`, `writeDist` and `write.nexus.dist` are useful to exchange distance matrices with other phylogenetic programs.

### Usage

    writeDist(x, file = "", format = "phylip", ...)

    write.nexus.dist(x, file = "", append = FALSE, upper = FALSE,
      diag = TRUE, digits = getOption("digits"), taxa = !append)

    readDist(file, format = "phylip")

    read.nexus.dist(file)

    ## S3 method for class 'dist'
    unique(x, incomparables, ...)

### Arguments

`x` | A `dist` object.
`file` | A file name.
`format` | file format, default is "phylip", only other option so far is "nexus".
`...` | Further arguments passed to or from other methods.
`append` | logical. If TRUE the nexus blocks will be added to a file.
`upper` | logical value indicating whether the upper triangle of the distance matrix should be printed.
`diag` | logical value indicating whether the diagonal of the distance matrix should be printed.
`digits` | passed to format inside of `write.nexus.dist`.
`taxa` | logical. If TRUE a taxa block is added.
`incomparables` | Not used so far.

### Value

an object of class `dist`

### Author(s)

Klaus Schliep klaus.schliep@gmail.com

### References

Maddison, D. R., Swofford, D. L. and Maddison, W. P. (1997) NEXUS: an extensible file format for systematic information. Systematic Biology, 46, 590–621.

### See Also

To compute distance matrices see `dist.ml` `dist.dna` and `dist.p` for pairwise polymorphism p-distances

### Examples

    data(yeast)
    dm <- dist.ml(yeast)
    writeDist(dm)
    write.nexus.dist(dm)

[Package phangorn version 2.6.2 Index]