Hello, Biostars.I am new in R and statistics.I am using package 'cluster' in R to analyse microarray data. "FUNcluster" in the "clusGap" needs a argument k while hierarchical clustering method like hclust() has no argument k. What should I do? Best wishes.
You can use the function
cutree(tree, k = NULL, h = NULL) with k parameter as follows to define the cluster function for clusGap:
mycluster <- function(x, k) list(cluster=cutree(hclust(dist(x), method = "average"),k=k))
?clusGap, FUNcluster needs to be a list with one element named 'cluster' containing integer numbers for the clusters.