Coder Social home page Coder Social logo

factoextra's People

Contributors

inventionate avatar kassambara avatar lioutasb avatar sandeepgithubrepo avatar scoavoux avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

factoextra's Issues

Is it possible to overplot/superimpose fviz_mca_biplot plots?

Is it possible to overplot/superimpose fviz_mca_biplot plots? if so, how? The par(new=T) convention I've seen for overplotting isn't working for me. I am trying to create overplots in jupyter notebooks running R kernel. also, I'm new to github, not sure if this counts as an 'issue'; its more a question. Apologies if this is the wrong forum to ask this.

factoextra and japanese text

(email from a user)
I am using Mac and RStudio/R.

When I use ggplot on my Mac, I have to set the font family to "sans"
(in .Rprofile I set up the "sans" to Japanese fonts)

Like this.

p <- ggplot(data, aes(x=Dim1,y=Dim2)) + theme_grey(base_family="sans")

So with  fviz_ca_biplot, I tried same way, but font did not selected.


library(FactoMineR)
library(factoextra)

.tbl2.1 <- matrix(c(395, 2456,1758,
                 147, 153, 916, 
                 694, 327, 1347),byrow=T,3,3)
dimnames(.tbl2.1) <- list(地域=c("オスロ","中部地域","北部地域"),
                       犯罪=c("強盗", "詐欺","破壊") )
.tbl2.1
res.CA <- CA(.tbl2.1,graph=FALSE)
p <- fviz_ca_biplot(res.CA,map="simbiplot",title="simbiplot")
p + theme_grey(base_family="sans")

Please advice me how I can select the Font for fviz_ca.

error with ade4 v1.7-5

factoextra fails with CA computed with the latest version of ade4 (v1.7-5).

Error generated when using fviz_ca():

Error in `[.data.frame`((inertia$row.abs/100), , colnames(coord)) : 
  undefined columns selected

"fviz_dend" can not show all the samples in the cluster dendrogram

Hi, I am using the example data "USArrests" for hierarchical k-means clustering and further visualize my own data. however, it seems that the "fviz_dend" does not work perfect and it can not show right number of the sample names in some of the tree cluster. For example, in "USArrests" example data, the res.hk$size showed a cluster got 8 samples, but only 7 samples were shown in using fviz_dend. Does anyone can figure this out. Thanks!

behaviour of the invisible option in fviz_pca()

Hello,

thanks for a very nice package, a great add-on to FactomineR.

In my own data, I have quite a lot of variables and I'd like to make a PCA-biplot where I summarized some variables. It works well, for the plotting, the ideal would be to have:

  • points for individuals
  • arrows for the quanti.sup only.

so I used the invisible option and it doesn't work as I expect.

see a reprex below

theme_set(theme_bw())
pca_deca <- PCA(decathlon2, scale.unit = TRUE, graph = FALSE, quanti.sup = 12, quali.sup = c(11, 13))
fviz_pca_biplot(pca_deca, invisible = "quanti.sup")
fviz_pca_biplot(pca_deca)

both give the same plots, while I would expect invisible = "quanti.sup" to remove Points
image

then

fviz_pca_biplot(pca_deca, invisible = "var")

image

I see only the quanti.sup. Shouldn't we keep the individuals and Points?
Am I misinterpreting how invisible works?

Session info -------------------
 setting  value                       
 version  R version 3.3.2 (2016-10-31)
 system   x86_64, darwin15.6.0        
 ui       RStudio (1.0.136)           
 language (EN)                        
 collate  en_US.UTF-8                 
 tz       Europe/Madrid               
 date     2017-02-06  
Packages ---------------------
 factoextra    * 1.0.4      2017-01-09 CRAN (R 3.3.2)                  
 FactoMineR    * 1.34       2016-11-17 CRAN (R 3.3.2)

PCA arrow width?

I'm using your great factoextra package to plot PCA results. I'd like to change the width of the arrows, as well as the width of the circle.

All my attempts so far were frustrated. Could you please give me any insights on how to do it?

two grouping variable using fviz_pca_biplot

(e-mail from a user)
I’m using fviz_pca_biplot and want to group individuals by two factors, is this possible? I was trying to use fill.ind and alpha.ind but couldn’t get alpha.ind to accept a factor variable.

Extension of factoextra to support vegan

(e-mail from a user)

Have you ever heard of CCA and RDA in package vegan? It can solve problems evolving multiple response variables, which can be really powerful. However, vegan provides poor visualization for biplots. So I think if you could get CCA and RDA into your packages, it would be really great.
On the other hand, I myself could hardly understand CA in ecology, while they use CA it means that the data would be unimodal(which means that the response variable is low at head and tail).The definition of CA in ecology and in a more general context is not quite alike yet still correlated to each other. It would be great if you could address this and make your packages popular among ecologists.

Colour individuals by custom continuous variable

Hello,

in 'fviz_pca_ind()', 'fviz_mfa_ind()' and similar functions, is it possible to colour individuals using a custom continuous variable?

I'm aware you can do that using one of the presets (e.g.: 'cos2') passed to the 'col.ind' argument and that you can use the 'habillage' argument to colour individuals using a custom factor variable, but neither of those things seems to be doing what I need.

Thank you!

Edit: Alternatively, is there a way to extract the ggplot2 object and edit it?

bug introduced in factoextra v1.0.4: fviz_cluster() for HCPC objects

MRE:

The following works in factoextra v1.0.3 but not in v1.0.4

library(FactoMineR)
library(factoextra)
data(iris)
res.pca <- PCA(iris[,1:4], graph=FALSE)
hc <- HCPC(res.pca, nb.clust=-1)
fviz_cluster(hc)
#> Error in fviz_cluster(hc): object 'res.hcpc' not found

The problem is in line 145, where I think it should read "object" rather than "res.hcpc".

fviz_pca_var - Question about contribution units

email from a factoextra user:

Dear Alboukadel,

I am using your “fviz_pca_var” function and I have one question.

When I do a PCA plot with variables (with function “fviz_pca_var”), and I color it by contribution (“contrib”), I have some variables with a value higher than 100. I thought that this contribution values was in percent (%) unit, but since I am having values higher than 100, I assume that the contribution unit is not percent (%).

Am I right? In which unit are the contribution values?

Best regards,
Bernardo

Ploting qualitative supplementary variables in FactoMiner-based PCA output

(e-mail from a user)

I contact you after trying to have an answer on various lists. After a PCA with FactoMiner, with one supplementary qualitative variable, I wish to have a graph with only the points and labels of this “quali.sup”. Something like the graph I get with :

plot.PCA(acp.ages, axes=c(1, 2), choix="ind",
   invisible="ind", col.quali="black",
   label="quali"),new.plot=TRUE,
   title="Classes d’âge")

I would be very gratefull if you can indicate me if there is a solution with factoextra (or ggplot2).

Issue with ellipses in MFA

Hi @inventionate,

I received by e-mail the following message:

Dear Alboukadel,
I am currently using factoextra to plot results I have obtained with factominer (using MFA).
The ellipses drawn by factoextra using the function fviz_mfa_ind() are drawn around the individuals, and not the barycenter/centroid as in factominer.
Is it possible to draw ellipses around barycenter/centroids in factoextra?
Thank you in advance,
Anne-Marie

Do you have any solution?

Best,
AK

Problem with "habillage" in fviz_mca_ind

Hi,

I tried this code:
fviz_mca_ind(res.mca, habillage=explain, addEllipses=TRUE, ellipse.level=0.95)+theme_minimal()

and I get this error:
Error in fviz_mca_ind(res.mca, habillage = explain) : could not find function ".scale_ca"

this happens while I installed factoextra_1.0.3.9000

Any idea about the problem?
Thanks.

Minor question about Factoextra package

First of all, congratulations for this useful package for visualizing clusters

I'm applying it for visualizing an object HCPC (a cluster obtained by HCPC method on an MCA analysis of plant categorical atributes attributes (FactomineR package)) in the way you explain and I have an error message when I try to apply the command fviz_cluster (factoextra package) to the HCPC object that I obtain from MCA (FactomineR package). The error message says:
Error in colMeans(x, na.rm = TRUE) : 'x' must be numeric

When I apply the fviz_cluster (factoextra package) to another HCPC object obtained from PCA (FactomineR package) I have no problems.

What can be the solution for this problem?
Thank you so much

Best regards

Alejandro Juárez-Escario

hkmeans only takes euclidean distance

Hi

I would like to use other (dis-) similarity measures. I understand that I can use get_dist() with hc.metric to specify the measure I want to use. I ended up obtaining the results generated based on euclidean distance for all cases.

All the best

Sandro

Add the environment argument in all fviz functions

One of the strange aspects of ggplot is that it is unable to "see" local objects in the aes() function , this problem extends to all geom functions as well. One way to around it is to use the "environment" argument to define local environment captured within function so that the aes() will check the local environment for variable scope instead (for reference, please see https://stackoverflow.com/questions/10659133/local-variables-within-aes)
https://stackoverflow.com/questions/22287498/scoping-of-variables-in-aes-inside-a-function-in-ggplot )

I have checked the documents of fviz and it does not pass the environment argument to its underlying ggplot wrappers. I would strongly suggest to make the environment argument available in all fviz functions to circumvent this problem. Thanks

Unexpected behavior of fviz_pca_biplot

Hello, this package crafts the most aesthetically please PCA plots I have seen so far. However, it appears that there are some unexpected behaviors for at least the fviz_pca_biplot function that I just can't seem to figure out. First of all, this link, http://www.sthda.com/english/wiki/ade4-and-factoextra-principal-component-analysis-r-software-and-data-mining, seems to provide way more information than either the factoextra tutorial on R documentation. Especially for things like how to add layers on top of fviz functions, which I assume are advanced wrapper of ggplot functions. So I guess either a link to that webpage should be provided in the R documentation or tutorial or more information can be included.
Now to the specific issues on fviz_pca_biplot:

  1. What does geom=c() do in this function? I am not sure if it concerns individuals/samples or variables, so far I could not see this doing anything. I would very much like to control the behaviors of individuals/samples and variables at the same time, perhaps making this function accepting a list (like select.var) or simply introduce geom.var geom.ind??
  2. Why col.var="contrib" or "cos2" etc. no longer works? I was trying to do a biplot with color gradient showing the cos2 or contribution of the variables (with col.gradients= ), but it reports "Error: Continuous value supplied to discrete scale", currently I am using alpha.var
  3. When I use col.var="contrib/cos2" or col.ind version in any of the plots, are the "contrib" or "cos2" calculated based on ALL axes or just the axes shown? I understand that contrib can be calculated for each ind/variable per each principal component so I assumed a single contrib or cos2 value for a variable or individual would have to be calculated based on weighted sum of those values across all axes/PCs (weighted by eigenvalues of PC)?

Sorry I did not have time to dig into the codes of functions which should provide an answer to q3 so hopefully you guys could help me a little bit. Thanks!

add loading colors in legend (feature request)

Me again,

Now that the invisible option is fixed in #26 (thanks again!), my goal is to have some colors for the quanti.sup while hiding the variables (or loadings). This is working fine, but that would be great to add them to the legend. In my case, the quanti.sup names are experiments and the colors should be the treated cells.

The ellipses are filled, so that take the fill legend. Great. The remaining issue is the color of individuals that should be let's say black, otherwise I cannot get the legend for the quanti.sup.

A plot explains better the problem

pca_deca <- PCA(decathlon2, scale.unit = TRUE, graph = FALSE, quanti.sup = 11:12, quali.sup = c(13))
fviz_pca_biplot(pca_deca, invisible = "var", habillage = "Competition",
                addEllipses = TRUE, col.ind = "black", pointshape = 19,
                col.quanti.sup = c("purple", "darkblue"))

image

see that the quanti.sup are properly colored but don't show up in the legend. And my attempt to use "black" for indiv was a bit naive.

Since, I am not sure how to solve this, here is a toy example of what should be achieved

# example adapted from this answer
# http://stackoverflow.com/a/20291006/1395352
library(FactoMineR)
library(tidyverse)
pca    <- prcomp(iris[, 1:4], retx = TRUE, scale. = TRUE) # scaled pca [exclude species col]
pca_iris <- PCA(iris[, 1:4], graph = FALSE)
var_iris <- pca_iris$var$coord %>%
  as.data.frame() %>%
  rownames_to_column(var = "var") %>%
  separate(var, into = c("flower", "measure"), sep = "\\.") %>%
  as_tibble()
scores <- pca$x[, 1:3]                        # scores for first three PC's

# k-means clustering [assume 3 clusters]
km     <- kmeans(scores, centers = 3, nstart = 5)
ggdata <- data.frame(scores, Cluster = km$cluster, Species = iris$Species)
# get some custom colors
my_col_var <- ggsci::pal_npg("nrc")(4)
my_col_ell <- ggsci::pal_uchicago()(3)

ggplot(ggdata) +
  geom_point(aes(x = PC1, y = PC2, shape = factor(Cluster)), size = 2) +
  stat_ellipse(aes(x = PC1, y = PC2, fill = factor(Cluster)),
               geom = "polygon", level = 0.95, alpha = 0.4) +
  geom_segment(data = var_iris, aes(x = 0, xend = Dim.1 * 2, colour = flower,
                                    y = 0, yend = Dim.2 * 2), size = 1.2, arrow = arrow(length = unit(0.03, "npc"))) +
  geom_text(data = var_iris, aes(x = Dim.1 * 2, colour = flower, label = measure,
                                 y = Dim.2 * 2), nudge_x = 0.2, nudge_y = 0.3, show.legend = FALSE) +
  scale_fill_manual(values = my_col_ell) +
  scale_colour_manual(values = my_col_var) +
  labs(fill = "cluster",
       shape = "cluster",
       colour = "loadings") +
  theme_bw(14)  

image

see that allows to add more information and reduce the text length. The shape mapping is not mandatory I think.

Remove or hide Zeroline on R ggplot2/factoextra plots

I am using this factoextra package in R to do Correspondent Analysis.

When I print out the result plot, I can't find the option to hide the x and y zeroline.
I know that the theme setting is based on ggplot 2. Can anyone help me to figure out how to hide those two lines?
Please find the code below.
fviz_ca_biplot(gen_show_ns.ca, geom =c( "text", "point"), col.col = "#FF6600", col.row = "#336699", MAP = "symbiplot", labelsize = 5, repel = TRUE, title = " " ) + theme(axis.line=element_blank(), axis.text.x=element_blank(), axis.text.y=element_blank(), axis.ticks=element_blank(), axis.title.x=element_blank(), axis.title.y=element_blank(), legend.position="none", panel.background=element_blank(), panel.border=element_blank(), panel.grid.major=element_blank(), panel.grid.minor=element_blank(), plot.background=element_blank())})

Any suggestion helps! Thanks so much

Possible extension of factoextra to include ExPosition

From private e-mail:

CA, MCA, PCA, MDS (ExPosition, InPosition for inferences)
Discriminant Correspondence Analysis (DiCA), PLSC, (TExPosition, TInPosition for inferences), barycentrique discriminant analysis
MFA, STATIS and variants (MExPosition)

jitter labels to avoid overplotting

Since factoextra uses the ggplot2 plotting system, is there a way to adjust the positioning of text labels (jitter), in order to avoid overlapping?

library("FactoMineR")
library("factoextra")

data(poison)
poison.active <- poison[1:55, 5:15]
res.mca <- MCA(poison.active, graph = FALSE)
fviz_mca_ind(res.mca)

fviz_nbcluster

Is there a way to change or remove the default main title on fviz_nbcluster?

Passing ggplot arguments to fviz_mca_biplot

Thanks very much for this work, its super helpful. I am pretty new, so excuse my ignorance, but when I pass some ggplot arguments (for example, renaming the legend using scale_fill_discrete(names = "foobar"), it does not replace the existing legend, but appears in addition to the default (see attached).
screenshot at feb 12 11-21-38

If I give my data frame column a nicely readable name that contains spaces the function chokes:

fviz_mca_biplot(MCA.object,

  •             invisible=c("ind"),
    
  •             habillage = 9,
    
  •             addEllipses = TRUE,
    
  •             repel = TRUE,
    
  •             labelsize = 3,
    
  •             ellipse.level = 0.95, 
    
  •             title = "test")+
    
  • theme_minimal()+
  • scale_fill_discrete(name = "Test")
    Error in parse(text = x) : :1:9: unexpected symbol
    1: Opinion on_courses_needed
    ^

Thanks for any help!

Installation problem

@kassambara @inventionate

I still can't install factoextra on my PC after trying several means but to no avail. the resulting command prompt it gives each time i try installing on my R studio v.3.3.2 is as followed:

_if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/factoextra")
Downloading GitHub repo kassambara/factoextra@master
from URL https://api.github.com/repos/kassambara/factoextra/zipball/master
Installing factoextra
Downloading GitHub repo kassambara/ggpubr@master
from URL https://api.github.com/repos/kassambara/ggpubr/zipball/master
Installing ggpubr
"C:/PROGRA1/R/R-331.2/bin/x64/R" --no-site-file --no-environ --no-save
--no-restore --quiet CMD INSTALL
"C:/Users/bright/AppData/Local/Temp/RtmpQzYpWA/devtools19c875f292c/kassambara-ggpubr-5b6e6b2"
--library="C:/Users/bright/Documents/R/win-library/3.3" --install-tests

  • installing source package 'ggpubr' ...
    ** R
    ** data
    *** moving datasets to lazyload DB
    ** inst
    ** preparing package for lazy loading
    Error in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]) :
    there is no package called 'rlang'
    ERROR: lazy loading failed for package 'ggpubr'
  • removing 'C:/Users/bright/Documents/R/win-library/3.3/ggpubr'
  • restoring previous 'C:/Users/bright/Documents/R/win-library/3.3/ggpubr'
    Error: Command failed (1)_

how do i get this done as I find this package really interesting and catchy. I don't whether you can be of help as I need this packages for my thesis analysis.

Thanks in anticipation.

Issue when running "habillage=" argument.

Returns: "Error: Unknown parameters: pointsize"

This is even true using the "tea" dataset plot example/s given in the guide posted. Otherwise everything seems to work fine and charts are well generated.

Example:

data(tea)
res.mca <- MCA(tea, quanti.sup=19, quali.sup=20:36)
fviz_mca_ind(res.mca, label='none', habillage=tea$sex, addEllipses = TRUE, ellipse.level = 0.95 )
Error: Unknown parameters: pointsize

fviz_pca_biplot - invisible = "var" Error

While trying to use the fviz_pca_biplot with the parameter invisible = "var" not only the var became invisible but the whole biplot disappeared/turned invisible, therefore not usable for me at the moment.

New fviz

Hi
I've started to create two new fviz toolsets both seems fit to factoextra and I do not want to start separate package :

  1. fviz_som to visualize som codes and heatmaps from kohonen packages
  2. fviz_apc to visualize affinity propagation clustering and dendrogram from APClustering packages.

Both packages (kohonen and APClustering) have its own, rather creepy and not configurable visualisations. I have working concepts for all functions, now I'm converting it into package ready files. How can I contribute it?
Jarek

Problem visualize clustering results(dbscan) with outliers.

Returns: "Unknown parameters: shape"

This is because there is a problem in .addoutliers function.

in fviz_cluster.R:
line 581: size = labelsize, vjust = -0.7, color = outlier.color, shape = outlier.shape)

If you remove the "shape = outlier.shape" it operates normally.

Example:

library(dbscan)
scaled_usa <- scale(USArrests)
fit <- dbscan(scaled_usa, eps=1.24, minPts=NCOL(scaled_usa) + 1)
fviz_cluster(fit, data=scaled_usa)
Error: Unknown parameters: shape

Thank you for factoextra.

fviz_dend doesn't work for diana object

Hello,

In fviz_dend file (line 134)
if(is.na(method)) method <- ""

But object$method is null when :

  • diana class
  • hcut with hc_func=diana

This cause error below :
Error in if (is.na(method)) method <- "" :
l'argument est de longueur nulle
De plus : Warning message:
In is.na(method) :
is.na() appliqué à un objet de type 'NULL' qui n'est ni une liste, ni un vecteur

Thank you for your work.

Possible Bug at factoExtra package function fviz_mca_ind

Dear Sir or Madam,

I am currently using your factoextra package for my analysis. However, I think I encountered a bug concerning the fviz_mca_ind function. More specifically, I create 95% confidence ellipses assuming the normal distribution and the Euclidian distance for all individuals that belong to certain groups.

It seems that when I use the Euclidean distance, first the code creates the ellipse taking into consideration all the individuals independent of the group characteristics and then the code produces confidence ellipses that are identical for all groups with the only difference that are shifted with respect to the mean of a given group. This is clearly misleading, as the shape of the ellipse might not only be shifted but also change (become smaller for example etc..)

I look forward to hearing from you.

Kind regards,
Giakoumis

bad default for lower_rect in fviz_dend

If lower_rect is not specified, it gets defined as -(labels_track_height+0.5) on line 189. This works very poorly when the height of the tree is small. I suggest defining lower_rect relative to the height of the tree, as the function does for labels_track_height, e.g., -max_height/4 would be reasonable

something changed. Japanese font on factextra again.

This is next issues of "factoextra and japanese text #31".
Problem was solved and #31 was closed.
But today, I encountred something wrong on this issue.

Previously I could use Japanese font(like "sans") as followings.
(This time, I use only R , not with RStudio. But the penomena is the same.)

library(FactoMineR) #version 1.38
library(factoextra) #version 1.0.5.999

CA

.tbl2.1 <- matrix(c(395, 2456,1758,
147, 153, 916,
694, 327, 1347),byrow=T,3,3)
dimnames(.tbl2.1) <- list(地域=c("オスロ","中部地域","北部地域"),犯罪=c("強盗", "詐欺","破壊") )
res.CA <- CA(.tbl2.1,graph=FALSE)
fviz_ca_biplot(res.CA,map="simbiplot",title="simbiplot",font.family = "sans")

MCA

poison_j <- read.csv(http://419kfj.sakura.ne.jp/db/wp-content/uploads/2017/05/poison.csv)
poison.active <- poison_j[1:55,5:15]
res.MCA <- MCA(poison.active,graph=FALSE)
fviz_mca_biplot(res.MCA, font.family = "sans")

But now, in both case, Japanese Text (in a scatter plot field) does not appear.
You can see correct plot by plot(res.CA) and plot(res.MCA)
Would you please check it again ?
If you need data(Japanese category names) and capture of outputs.

My environment:
OS X 10.11.6
R 3.4.2 GUI 1.70 El Capitan build (7434)
FactoMineR version 1.38
factoextra version 1.0.5.999
ggpubr version 0.1.5.999

kazuo

Habillage parameter crashes fviz_pca_ind() with new R 3.3.1

Hi,

I have a problem with factoextra crashing upon plotting a PCA object from FactoMineR. This worked flawlessly with R 3.2.2 from end of last year.

the following code crashes for me:

library(FactoMineR)
library(factoextra)
respca=PCA(mtcars[1:7])
fviz_pca_ind(respca, habillage=mtcars$carb)

with this error:

Error in `[.data.frame`(X$call$X, rownames(ind), grp, drop = FALSE) : 
  undefined columns selected
Calls: fviz_pca_ind ... .add_ind_groups -> as.data.frame -> [ -> [.data.frame
Execution halted

my session:

Session info -------------------------------------------------------------------
 setting  value
 version  R version 3.3.1 (2016-06-21)
 system   x86_64, linux-gnu
 ui       X11
 language en_US:en
 collate  en_US.UTF-8
 tz       <NA>
 date     2017-02-03

Packages -----------------------------------------------------------------------
 package       * version date       source
 assertthat      0.1     2013-12-06 CRAN (R 3.3.1)
 cluster         2.0.5   2016-10-08 CRAN (R 3.3.1)
 colorspace      1.3-1   2016-11-18 CRAN (R 3.3.1)
 curl            2.3     2016-11-24 CRAN (R 3.3.1)
 devtools      * 1.12.0  2016-06-24 CRAN (R 3.3.1)
 digest          0.6.12  2017-01-27 cran (@0.6.12)
 factoextra    * 1.0.4   2017-02-03 Github (kassambara/factoextra@a57b53d)
 FactoMineR    * 1.34    2016-11-17 CRAN (R 3.3.1)
 flashClust      1.01-2  2012-08-21 CRAN (R 3.3.1)
 ggplot2       * 2.2.1   2016-12-30 cran (@2.2.1)
 ggrepel         0.6.5   2016-11-24 CRAN (R 3.3.1)
 git2r           0.16.0  2016-11-20 CRAN (R 3.3.1)
 gtable          0.2.0   2016-02-26 cran (@0.2.0)
 httr            1.2.1   2016-07-03 CRAN (R 3.3.1)
 knitr           1.15.1  2016-11-22 CRAN (R 3.3.1)
 lattice         0.20-34 2016-09-06 CRAN (R 3.3.1)
 lazyeval        0.2.0   2016-06-12 CRAN (R 3.3.1)
 leaps           3.0     2017-01-10 CRAN (R 3.3.1)
 MASS            7.3-45  2016-04-21 CRAN (R 3.3.1)
 memoise         1.0.0   2016-01-29 CRAN (R 3.3.1)
 munsell         0.4.3   2016-02-13 cran (@0.4.3)
 plyr            1.8.4   2016-06-08 cran (@1.8.4)
 R6              2.2.0   2016-10-05 CRAN (R 3.3.1)
 Rcpp            0.12.8  2016-11-17 CRAN (R 3.3.1)
 rstudioapi      0.6     2016-06-27 CRAN (R 3.3.1)
 scales          0.4.1   2016-11-09 CRAN (R 3.3.1)
 scatterplot3d   0.3-38  2017-01-05 CRAN (R 3.3.1)
 tibble          1.2     2016-08-26 CRAN (R 3.3.1)
 withr           1.0.2   2016-06-20 CRAN (R 3.3.1)

As soon as I remove the habillage parameter it works again. This was a clean R 3.3.1 64Bit install on a Linux Debian system with the most recent FactoMineR from cran and factoextra from your github page.

Do you have any idea what's going on here?

Best,
Carsten

Strange letter in the legend when using habillage in fviz_pca_ind of factoextra package

Dear Alboukadel,

Thanks your great work of the package factoextra.

I am using it for visualize the results of PCA. When I used the following code, a strange letter "a" occurred in the legend and the symbols were also weird (please see the attachment),

library(FactoMineR)
library(factoextra)
respca<-PCA(mtcars[1:7])
fviz_pca_ind(respca,habillage = mtcars$carb)

when I used ggplot2 to plot, I also found the problem. After I inserted "show.legend = FALSE" in the geom_text function, the legend was normal.

Would you pleas tell me how to avoid the strange letter in fviz_pca_ind

Thank you in advance.

a

Problem Hierarchical clustering with eclust

Hi,

I think i detected a problem in your code, however i don't know how to make submitions in github. I can also be wrong.

in eclust.R:
line 119: res.dist <- get_dist(x, method = hc_metric)
and after that you call line 127: res.hc <- hcut(res.dist, k, hc_func = FUNcluster, hc_method = hc_method )

in hcut.R:
line 63 to 69: you rescale the matrix of distances and calculate again the distances over an already distance matrix
x <- get_dist(x, method = hc_metric)

this makes your eclust function to give results difrent from "hclust" library.
If you call "hcut function" directly the results are correct!

Object of class `dist` as an input to `fviz_nbclust`

Hi!

I've tried to use fviz_nbclust function. Based on the help page, it should takes an object x (matrixor data.frame). However, it's also possible to put there dist object and to get different results:

library('cluster')
library('factoextra')
options(scipen=9)

df <- USArrests
dist_df <- dist(USArrests)

fviz_nbclust(x=df, FUNcluster=pam, method='wss')
fviz_nbclust(x=dist_df, FUNcluster=pam, method='wss')

I've checked the source code and found out that inside the function fviz_nbclust every x object is transformed to dist object. Maybe the better way is to transform only matrixand data.frameobject and not transforming dist. Alternatively (but probably not so good) is to forbid dist object as an input.

What do you think?

Can't download and install factoextra

Hello kassambara,

I am using a mac mini computer (macOS Sierra version 10.12) with R (version 3.1.3 (2015-03-09)) and have tried with:

if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/factoextra")

And I receive the message:

Downloading github repo kassambara/factoextra@master
Installing factoextra
Skipping 2 packages not available: ggpubr, ggrepel
'/Library/Frameworks/R.framework/Resources/bin/R' --no-site-file --no-environ --no-save --no-restore CMD INSTALL
'/private/var/folders/yq/krbpxmw145gg83g7dj3rc_q80000gp/T/RtmpH9nzgY/devtools4bf4bb78637/kassambara-factoextra-cb13301'
--library='/Library/Frameworks/R.framework/Versions/3.1/Resources/library' --install-tests

ERROR: dependencies ‘ggpubr’, ‘ggrepel’ are not available for package ‘factoextra’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/factoextra’
    Error: Command failed (1)

Then when I try to install ggpubr

if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/ggpubr")
I get:

ERROR: dependencies ‘ggrepel’, ‘ggsci’ are not available for package ‘ggpubr’

  • removing ‘/Library/Frameworks/R.framework/Versions/3.1/Resources/library/ggpubr’
    Error: Command failed (1)

And when I try with either ggrepel or ggsci

if(!require(devtools)) install.packages("devtools")
devtools::install_github("kassambara/ggrepel")
I get:

Downloading github repo kassambara/ggrepel@master
Error in download(dest, src, auth) : client error: (404) Not Found

Do you know why I get these errors and how I can use factoextra?

Regards,
ltomaziu

New options in fviz_pca_biplot - use multiple grouping variables for different: aesthetics, color, shape, line

Hi,

I am trying to draw a biplot using FactoMineR and factoextra, with the function fviz_pca_biplot. I would like to know if it is possible to have two level to draw the plot:

  • one level to define one group by colour;
  • a second one to define another group, on the same data set, by shape of the point.

I was able to define so far one by color, with that line:
fviz_pca_biplot(res.pca, geom = "point",
col.ind = as.numeric(DataPCA$region_Name)

But now, i would also add a line that would set shape point corresponding to another column of my data set.

Thank you for your help.

Regards,

Six discrete values limitation with fviz_pca_biplot

Hi,

As there is limitation of 6 discrete values with fviz_pca_biplot and I have 20, is there a better/automated way instead of using scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"...,"#20B2E2")? Furthermore, How can I change the symbols?

Thanks

Six discrete values limitation with fviz_pca_biplot

Hi,

As there is limitation of 6 discrete values with fviz_pca_biplot and I have 20 Is there a better/automated way instead of using scale_color_manual(values=c("#999999", "#E69F00", "#56B4E9"...,"#20B2E2")?

Thanks

factoextra online documentation

Hi @inventionate

I planned to submit factoextra on CRAN this friday.

To be accepted, CRAN requires "Examples for function" with CPU or elapsed time < 5s

Therefore, I simplified the example section of all the functions and the fviz_*() functions now use ggplot2::stat_ellipse() to draw ellipses.

I started building an online documentation (http://www.sthda.com/english/rpkgs/factoextra/) so that users can quickly browse documentation and examples.

Have a great day,
AK

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.