**610**wrote:

Dear all,

im trying to find the optimum number of clusters to fit to a gene expression dataset.

For this, Im using the packages `FactoMineR`

and `factoextra`

and the function `fviz_nbclust`

on my scaled dataframe (simple dataframe with genes in rows and samples in columns).

It scales (z-scoring) by column so im transposing first and then scaling. Then i retranspose and calculate the optimal number of clusters.

The **problem** is that i get a Warning message " did not converge in 10 iterations ".

**The question is, do you know a way to modify the number of iteractions?**

This is the code im using

```
df <- scale (t(mydata))
df <- t(df)
fviz_nbclust(df, kmeans, method = "gap_stat")
fit <- kmeans(df, ?)
mydata2 <- data.frame(df, fit$cluster)
```

?: this value is dictated by the clusters prediction

Thanks in advance

**41k**• written 10 months ago by lessismore •

**610**