Entering edit mode
Henrique Proença
▴
80
@henrique-proenca-2762
Last seen 10.2 years ago
Hello,
I am trying to apply the function "hcluster" (contained within the
"amap" package) to data matrix with no variability between its
columns.
The example I am using is:
x <-
data.frame(col1=c(20,30,45,7,6,5,4,3),col2=c(20,30,45,7,6,5,4,3),
stringsAsFactors=FALSE)
hcluster(x, method="correlation", link = "complete")
In this case, the error generated is fatal and the application (R
environment) stops completely (crashes) without any control of the
error. I do understand it in the way one can not apply the correlation
to a vector with no variability, but in the following case:
x <-
data.frame(col1=c(20,30,45,7,6,5,4,3),col2=c(20,30,45,7,6,5,7,7),
stringsAsFactors=FALSE)
hcluster(x, method="correlation", link = "complete")
There are rows without variability, and others (last two rows)
containing some. When I use this example, the R environment does not
crash. So, my question is: Why the "hcluster" funcions generates this
fatal error when no variability is found in all the matrix rows ?
Thanks in advance
--
Regards
Henrique Proen?a