# Import data

```{r eval=FALSE}
wine <- read.table("data_MFA_WineJurys.csv", header=TRUE, sep=";", check.names=FALSE, 
     row.names=1, fileEncoding="latin1")
```
```{r echo=FALSE}
wine <- read.table("C:/Users/houee/Documents/data_MFA_WineJurys.csv", 
      header=TRUE, sep=";",dec=".", row.names=1, check.names=FALSE)
```
```header=TRUE``` : indicates that the file contains the names of the variables

```sep=";"``` : indicates the fields separator (usually ";" or "," for csv files)

```row.names=1``` : indicates the column of the table which contains the row names

It is important to check that the import is well done

```{r eval=FALSE}
summary(wine)
```

# Loading FactoMineR
```{r}
library(FactoMineR)
```

# MFA without supplementary groups
```{r}
res <- MFA(wine[,2:58], group=c(27,15,15), type=rep("s",3), 
           name.group=c("Expert","Student","Consumer"))
```

# MFA with supplementary groups
```{r}
res <- MFA(wine, group=c(1,27,15,15,60), type=c("n",rep("s",4)), num.group.sup=c(1,5),
           name.group=c("Grade","Expert","Student","Consumer","Appreciation"))
```

A summary of the main results with the ```summary.MFA``` function

```{r eval=FALSE}
summary(res)
```

The results are given on the first 2 dimensions

```{r}
summary(res, ncp=2)
```

# Description of dimensions
```{r}
dimdesc(res)
```

# Graph of the groups of variables
```{r}
plot(res,choix="group",cex=1.2)
```

# Graph of the  individuals
```{r}
plot(res, habillage=1)
```

# Graph of the variables
```{r}
plot(res,choix="var", invisible="quanti.sup", title="Graph of the active variables")
```

# Graph with variables selection
```{r}
selection = c(grep("passion",rownames(res$quanti.var$coord),fixed=TRUE),
    grep("Acidity",rownames(res$quanti.var$coord),fixed=TRUE),
    grep("Sweetness",rownames(res$quanti.var$coord),fixed=TRUE))
plot(res,choix="var",select=selection,invisible="quanti.sup")

plot(res,choix="var", invisible="quanti", habillage="none", lab.var=FALSE, 
     title="Graph of the supplementary variables")
```

# Graph with the partial points
```{r}
plot(res,choix="ind", partial="all", invisible="quali", title="Graph with the partial points")
plot(res, cex=0.8, invisible="ind", partial="all", title="Graph of the individuals")
```

# Graph of the partial axes
```{r}
plot(res,choix="axes")
plot(res, cex=0.8, invisible="ind", partial="all")
```

# Color the individuals according to a qualitative variable
```{r}
plot(res, cex=0.8, habillage=1)
```
