Answers.Body: <p>I actually found an answer just accidentally. It is very unfortunate that <code>factoextra</code> documentation does not explicitly say that <code>data</code> parameter should be of <code>data.frame</code> type. In my case <code>rtsne$Y</code> was a <code>matrix</code>. The error that <code>factoextra</code> is giving is very uninformative.</p>
  
  <p>Here is the code that ultimately worked:</p>
  
  <pre><code>fviz_cluster(db, 
  -----&gt;  data = as.data.frame(rtsne$Y), 
          stand = FALSE,
          ellipse = FALSE, show.clust.cent = FALSE,
          geom = "point",palette = "jco", ggtheme = theme_classic())
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-20T09:25:39.797Z
Answers.Text: I am using fviz_cluster as well, but for PCA clustering. I have a separate question that I've asked but haven't gotten the perfect answer, when you put geom = "label", where does it take the labels from? My guess would be the rownames, but the rownames in my data.frame are non unique. What do I do?
Answers.UserDisplayName: rishi
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-01-29T18:36:45.140Z
Answers.LastActivityDate: 2018-01-29T18:36:45.140Z
Answers.UserDisplayName: Nikita Vlasenko
Body: <p>I just followed the <a href="http://www.sthda.com/english/articles/30-advanced-clustering/105-dbscan-density-based-clustering-essentials/" rel="nofollow noreferrer">tutorial</a> trying to do clustering on my own data, but I can't visualize it because <code>fviz_cluster</code> function is giving me an error:</p>
  
  <blockquote>
    <p>Error in if (xlab == "x") xlab &lt;- "x value" : argument is of length zero</p>
  </blockquote>
  
  <p>Here is the code I am running:</p>
  
  <pre><code>library("fpc")
  db &lt;- fpc::dbscan(rtsne$Y, eps = 0.15, MinPts = 5)
  # Plot DBSCAN results
  library("factoextra")
  fviz_cluster(db, data = rtsne$Y, stand = FALSE,
          ellipse = FALSE, show.clust.cent = FALSE,
           geom = "point",palette = "jco", ggtheme = theme_classic())
  </code></pre>
  
  <p>How can I make <code>fviz_cluster</code> function working?</p>
  
  <blockquote>
    <p>Update</p>
  </blockquote>
  
  <p>Filed a bug: <a href="https://github.com/kassambara/factoextra/issues/62" rel="nofollow noreferrer">https://github.com/kassambara/factoextra/issues/62</a></p>
  
Tags: <clustering>
Title: factoextra: Error in if (xlab == "x") xlab <- "x value" : argument is of length zero
ThreadText: # factoextra: Error in if (xlab == "x") xlab <- "x value" : argument is of length zero
  
  (Asked by: username_0 on 2018-01-29)
  
  I just followed the [tutorial](http://www.sthda.com/english/articles/30-advanced-clustering/105-dbscan-density-based-clustering-essentials/) trying to do clustering on my own data, but I can't visualize it because `fviz_cluster` function is giving me an error:
  
  > Error in if (xlab == "x") xlab <- "x value" : argument is of length zero
  
  Here is the code I am running:
  
  ```
  library("fpc")
  db <- fpc::dbscan(rtsne$Y, eps = 0.15, MinPts = 5)
  # Plot DBSCAN results
  library("factoextra")
  fviz_cluster(db, data = rtsne$Y, stand = FALSE,
          ellipse = FALSE, show.clust.cent = FALSE,
           geom = "point",palette = "jco", ggtheme = theme_classic())
  
  ```
  
  How can I make `fviz_cluster` function working?
  
  > Update
  
  Filed a bug: <https://github.com/kassambara/factoextra/issues/62>
  
  **Tags:** clustering
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-01-29. Score: 3 | Accepted answer
  
  I actually found an answer just accidentally. It is very unfortunate that `factoextra` documentation does not explicitly say that `data` parameter should be of `data.frame` type. In my case `rtsne$Y` was a `matrix`. The error that `factoextra` is giving is very uninformative.
  
  Here is the code that ultimately worked:
  
  ```
  fviz_cluster(db, 
  ----->  data = as.data.frame(rtsne$Y), 
          stand = FALSE,
          ellipse = FALSE, show.clust.cent = FALSE,
          geom = "point",palette = "jco", ggtheme = theme_classic())
  
  ```
  
  > **Comments:**
  > **username_1**: I am using fviz_cluster as well, but for PCA clustering. I have a separate question that I've asked but haven't gotten the perfect answer, when you put geom = "label", where does it take the labels from? My guess would be the rownames, but the rownames in my data.frame are non unique. What do I do?  
  
  ---
  
  