Displaying 1 result from an estimated 1 matches for "clmembfun".
Did you mean:
clmembfun1
2009 Apr 10
0
recursive function, how to avoid list structure in return value
...= rbind(c(-1, -2),
c(-3, -4),
c(2, -5),
c(1, 3),
c(4, -6)),
height = 1:5,
order = 1:6)
## plot the example / fake tree
stats:::plot.hclust(myClust, hang = -1)
## recursive function to extract members of a cluster
## 'sapply' version
clMembFun1 <- function(x) {
if(x < 0) {
-x
} else {
sapply(1:2, function(j) clMembFun1(myClust$merge[x,j]))
}
}
Here's a transcript of using clMembFun:
> ## trivial case of cluster = 2 singletons is OK
> clMembFun1(1)
[1] 1 2
> str(clMembFun1(1))...