R - MCA (multiple correspondence analysis) with badly formated data

169 Views Asked by At

I'm new to R programming language but i know the theory behind the MCA. My problem is, i am asked to read a specific file that contains qualitative data reprented by a numeric value, like an enumeration would be in C# for example. Also, i think i need to get the data as a contingency table in order to call the MCA function (contained in the FactoMineR package).

Here's the data :

1;1;1;1;1;3
2;1;1;1;2;2
3;1;1;2;1;3
4;1;1;2;2;1
5;1;2;1;1;3
6;1;2;1;2;2
7;1;2;2;1;3
8;1;2;2;2;1
9;2;1;1;1;3
10;2;1;1;2;2
11;2;1;2;1;3
12;2;1;2;2;1
13;2;2;1;1;3
14;2;2;1;2;2
15;2;2;2;1;3
16;2;2;2;2;3
17;3;1;1;1;3
18;3;1;1;2;3
19;3;1;2;1;3
20;3;1;2;2;1
21;3;2;1;1;3
22;3;2;1;2;2
23;3;2;2;1;3
24;3;2;2;2;3

As you can notice, there are no column headings and the first column should be dropped since it only acts as a rowCountIndex.

Here are the column headings (in appearance order) i'd like to obtain (first level)(those are in french) and the row index (second level) and the key they are referencing to:

"niveau_age"
    "young" (1)
    "pre-presbyopic" (2)
    "presbyopic" (3)
"pathologie"
    "myope" (1)
    "hypermetrope" (2)
"astigmatisme"
    "no" (1)
    "yes" (2)
"larmes"
    "reduced" (1)
    "normal" (2)
"type"
    "rigides" (1)
    "souples" (2)
    "decons" (3)

Note : I tried creating the header this way (not sure if it's the way i'm supposed to...) :

FRow <- factor(c(1:12), labels=c("young", "pre-presbyopic", "presbyopic", "myope", "hypermetrope", "no", "yes", "reduced", "normal", "rigides", "souples", "deconseillees"))
FCol <- factor(c(1:5), labels=c("niveau_age", "pathologie", "astigmatisme", "larmes", "type"))

I would be particularly grateful to any help !

0

There are 0 best solutions below