[R] Colorizing different individuals with fviz

Bill Dunlap w||||@mwdun|@p @end|ng |rom gm@||@com
Mon Mar 29 23:25:30 CEST 2021


That error means that fviz_famd_ind has more than one argument that
starts with 'col' and you must type a more complete name to
disambiguate it.  Perhaps col.ind=ifelse(...)?

> args(factoextra::fviz_famd_ind)
function (X, axes = c(1, 2), geom = c("point", "text"),
    repel = FALSE, habillage = "none", palette = NULL,
    addEllipses = FALSE, col.ind = "blue", col.ind.sup = "darkblue",
    alpha.ind = 1, shape.ind = 19, col.quali.var = "black",
    select.ind = list(name = NULL, cos2 = NULL, contrib = NULL),
    gradient.cols = NULL, ...)

On Mon, Mar 29, 2021 at 2:20 PM Mahmood Naderan-Tahan
<mahmood.naderan using ugent.be> wrote:
>
> Hi Jim,
>
> It seems that the following proposed method doesn't work
>
>
> ind <- get_famd_ind(res.famd)
> fviz_famd_ind(res.famd,
>               col=ifelse(x>10,"red","black"),
>               repel = TRUE)
>
>
> Result is:
>
>
> Error in fviz_famd_ind(res.famd, col = ifelse(x > 10, "red", "black"),  :
>   argument 2 matches multiple formal arguments
>
>
>
> Any idea to fix that?
>
> Regards,
> Mahmood
>
> ________________________________
> From: Jim Lemon <drjimlemon using gmail.com>
> Sent: Saturday, March 27, 2021 9:19:23 PM
> To: Mahmood Naderan-Tahan
> Cc: r-help using r-project.org
> Subject: Re: [R] Colorizing different individuals with fviz
>
> Hi Mahmood,
> What you have specified can be done with:
>
> col=c(rep("black",10),rep("red",10))
>
> depending upon what print function you are using. I suspect that this
> may be based on a value in your data. For example, if you want  black
> for values of some variable up to 10 and red for those over:
>
> col=ifelse(x>10,"red","black)
>
> Jim
>
> On Sun, Mar 28, 2021 at 12:20 AM Mahmood Naderan-Tahan
> <mahmood.naderan using ugent.be> wrote:
> >
> > Hi
> >
> > I use this command to generate a graph of individuals
> >
> >
> > ind <- get_famd_ind(res.famd)
> > fviz_famd_ind(res.famd, repel = TRUE)
> >
> >
> > I would like to know how can I specify different colors for different individuals?
> >
> > The colorization is not very complex. Basically, I want to specify rows[1:10] to be shown in black and rows[11:20] to be shown in red.
> >
> >
> > Any idea about that?
> >
> >
> > Regards,
> > Mahmood
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list