hc2Newick: Convert hclust objects to Newick format files

Description Usage Arguments Value Author(s) References Examples

View source: R/hc2Newick.R

Description

Convert hclust objects to Newick format files.

Usage

1
  hc2Newick(hc, flat=TRUE)

Arguments

hc

a hclust object (as returned by the function hclust in the package stats)

flat

a boolean (see section value).

Value

If flat=TRUE the result is a string (that you can write in a file).

If flat=FALSE the result is a list (of lists). Each list is consituted of the elements left, right and dist.

Author(s)

Laurent (laurent@cbs.dtu.dk)

References

Antoine Lucas and Sylvain Jasson, Using amap and ctc Packages for Huge Clustering, R News, 2006, vol 6, issue 5 pages 58-60.

Examples

1
2
3
data(USArrests)
h = hclust(dist(USArrests))
write(hc2Newick(h),file='hclust.newick')

Example output

Loading required package: amap

ctc documentation built on Nov. 8, 2020, 5:11 p.m.