datURL <- "https://bugs.r-project.org/bugzilla/attachment.cgi?id=1659"
dat <- as.matrix(read.csv(file=datURL, row.names=1))
dist2 <- function(x) as.dist(1-cor(t(x), method="pearson"))
hclust1 <- function(x) hclust(x, method = "single")
distance <- dist2(dat)
cluster <- hclust1(distance)
dend <- as.dendrogram(cluster)
## Not run:
# ## In R 2.3.0 and earlier crashes R: with a node stack overflow error
# plot(dend)
# ## Error in xy.coords(x, y, recycle = TRUE) : node stack overflow
# ## End(Not run)
## convert stats:::plotNode from byte-code to interpreted-code
unByteCodeAssign(stats:::plotNode)
# increase recursion limit
options("expressions"=5e4)
# now the function does not crash
plot(dend)
Run the code above in your browser using DataLab