Bug 15702 - order.dendrogram(leaf) -> dendrogram instead of integer
Summary: order.dendrogram(leaf) -> dendrogram instead of integer
Status: CLOSED FIXED
Alias: None
Product: R
Classification: Unclassified
Component: Language (show other bugs)
Version: R 3.0.2
Hardware: Other Other
: P5 trivial
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2014-03-06 00:33 UTC by Bill Dunlap
Modified: 2015-12-14 13:47 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bill Dunlap 2014-03-06 00:33:16 UTC
order.dendrogram generally returns an integer vector, but when it is given a single-leaf dendrogram it returns a single-leaf dendrogram (containing the integer it should return) instead of the bare integer.

> d <- as.dendrogram(hclust(dist(sin(1:7))))
> str(d[[c(2,1,2)]]) # single-leaf dendrogram
--leaf 5 
> str(order.dendrogram(d[[c(2,1,2)]]))
--leaf 5 
> as.vector(d[[c(2,1,2)]]) # expected value
[1] 5

> str(d[[c(2,1)]])
--[dendrogram w/ 2 branches and 2 members at h = 0.202]
  |--leaf 4 
  `--leaf 5 
> str(order.dendrogram(d[[c(2,1)]])) # returns integer vector
 int [1:2] 4 5