0
$\begingroup$

On 27/03/2020 at 3:03 pm Hi,

I would like to point out that I am a beginner in R

Contextualization prior to my problem: My database is the result of a verbal association experiment where individuals are represented in row and the words and supplementary points (sociodemographic) in column. I wish to conduct a correspondence analysis.

When I query the console with str(): all the words appear well coded in numerical form with their frequency (1 or more if the word has been quoted several times and 0 if not quoted), the additional variables such as gender, marital status, etc. appear all in factor. My original table is called Afc_france, the clean and coded one is called Afc_france_rec

Here is an example of how I recoded the gender variable:

Afc_france$Genre_rec <- recode(Afc_france$Genre,
"*sex_H" = "Man",
"*sex_F" = "Female")
Afc_france$Genre_rec <- factor(Afc_france$Genre_rec)

I then collected all the data in a new table, removing the additional variables that were not recoded. The result is:

Afc_france_rec<-select(Afc_france, -Genre,
-Matrimonial_status,-Nationality,
-Residence,-Nvxetude,-Domainspe,-Domgene)

I use two libraries FactoMineR and Factorextra First problem, the extra columns don't display when I use Factorextra but do it with FactoMiner, I don't understand why :(. However here is what I wrote before the command to display the biplot, it seems to me that it is correct? :

res.ca <- CA (Afc_france_rec,row.sup = NULL, quali.sup = 57:63,
graph = TRUE)

Indeed, when I write the baseline which is:

res.ca <- CA (Afc_france_rec,row.sup = NULL, col.sup = 57:63,
graph = TRUE)

I get an error message saying that my additional variables are not quantitative. It seems to me that this is normal, because indeed they are not quantitative. It seems that Fviz.ca does not understand that my extra column is a factor and it does not seem that the col.quali.sup argument can incorporate a qualitative column. Indeed, I don't get an error message but when I plot the supplementary points don't appear on the biplot

fviz_ca_col(res.ca, axes = c(1, 2), shape.col = 17,
            geom = c("point", "text"), label = "all",
            invisible = "none", labelsize = 4, pointsize = 2,
            col.col = "red", col.col.sup = "darkred", alpha.col = 1,
            select.col = list(name = NULL, cos2 = NULL, contrib = NULL),
            map = "symmetric",
            jitter = list(what = "label", width = NULL, height = NULL))

My solution is to write to grace FactoMineR this command :

res.ca <- CA (Afc_france_rec,row.sup = NULL, col.sup = 57:63,
graph = TRUE)

Even if it works, I can't take advantage of the factorextra repel command that increases readability :(. Would you have another solution that would allow me to display the modalities of my supplementary points on the biplot, with the repel (or equivalent) option?

Thank you in advance for your help.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.