[R] Problem extracting labels from a large dendrogram
Oleksandr Moskalenko
om at hpc.ufl.edu
Fri Jan 4 02:45:13 CET 2013
Hi,
I have an issue with extracting labels from a ~30k member dendrogram using a 64-bit R/2.15.1 build. Inevitably, the following error pops up when using labels(dendrogram_object) - "Error in match.fun(FUN) : node stack overflow". I though the issue was the stack size, so I rebuilt R with a much larger max-ppsize limit and kept raising it on the command line with --max-ppsize, but it didn't work even with R running with a 500 million --max-ppsize. I notice that the process consistently grows up to about 39-40Gb of RAM before the error happens. I've been trying to find a way around it, but using dendrapply didn't work out either. Same error happened.
Here is an example:
> attributes(h)
$members
[1] 27109
$midpoint
[1] 2.609272
$height
[1] 6322.5
$class
[1] "dendrogram"
> local({
getLab <<- function(n) {
if(is.leaf(n)) {
a <- attributes(n)
i <<- i+1
lbl <- attr(n, "label")
}
n
}
i <- 0
})
> n2 <- dendrapply(h, getLab)
Error in `[[.dendrogram`(X, 1L) : node stack overflow
Thanks,
Alex
More information about the R-help
mailing list