Library

library(dplyr)
## 
## Attaching package: 'dplyr'
## 
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## 
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(tidyr)
library(ade4)
library(adegraphics)
## 
## Attaching package: 'adegraphics'
## 
## The following objects are masked from 'package:ade4':
## 
##     kplotsepan.coa, s.arrow, s.class, s.corcircle, s.distri,
##     s.image, s.label, s.logo, s.match, s.traject, s.value,
##     table.value, triangle.class
library(car)
## Warning: package 'car' was built under R version 3.2.2
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 3.2.2
library(foreign)
## Warning: package 'foreign' was built under R version 3.2.2
library(doBy)
## Warning: package 'doBy' was built under R version 3.2.2
## Loading required package: survival
dat2 <- read.csv("C:/Users/Antoine/Desktop/dat2.csv")

colnames(dat2)
##  [1] "UID_DYNA" "wave"     "id"       "lo"       "npa"      "pcf"     
##  [7] "pg"       "ps"       "prg"      "vec"      "mod"      "udi"     
## [13] "ump"      "dlr"      "fn"       "pgx"      "pdx"      "i9r"
head(dat2)
##   UID_DYNA wave  id lo npa pcf pg ps prg vec mod udi ump dlr fn       pgx
## 1        1    2 1_2  0   0   0  0  5   0   0   3   9   7   0  0 0.7142857
## 2        1    1 1_1  0   0   0  0  2   0   0   3   0  10   0  0 0.2857143
## 3        1    4 1_4  0   0   0  0  2   0   2   4   3   7   2  0 0.5714286
## 4        1    6 1_6  0   0   0  0  2   0   2   4   3   8   3  0 0.5714286
## 5        1    7 1_7  0   0   0  0  5   3   0   0   6   7   4  0 1.1428571
## 6        2    4 2_4  0   1   1  1  4   3   1   5   3   2   2  0 1.5714286
##    pdx i9r
## 1 4.75   8
## 2 3.25   8
## 3 4.00   7
## 4 4.50   8
## 5 4.25   8
## 6 3.00   4
dat2$i9r <- as.factor(dat2$i9r)
dat2$wave <- as.factor(dat2$wave)
dat2$UID_DYNA <- as.factor(dat2$UID_DYNA)
dat2 <- dat2[order(dat2$wave, dat2$UID_DYNA),]

head(dat2)
##    UID_DYNA wave  id lo npa pcf pg ps prg vec mod udi ump dlr fn       pgx
## 2         1    1 1_1  0   0   0  0  2   0   0   3   0  10   0  0 0.2857143
## 9         2    1 2_1  4   2   2  3  5   1   3   0   0   0   0  3 2.8571429
## 15        3    1 3_1  0   0   0  0  3   0   5   5   4   8   0  6 1.1428571
## 18        7    1 7_1  0   0   0  0  4   0   0   5   5   5   0  0 0.5714286
## 21        8    1 8_1  0   0   1  1  4   3   1   1   1   0   0  0 1.4285714
## 30        9    1 9_1  5   5   5  5  5   5   5   5   5   5   5  5 5.0000000
##     pdx i9r
## 2  3.25   8
## 9  0.00   4
## 15 4.25   8
## 18 3.75   6
## 21 0.50   4
## 30 5.00   6
s1 <- select(dat2, pgx, pdx)
s2 <- select(dat2, i9r)
s.class(s1, s2$i9r, col = rainbow(11))

s1.1 <- select(dat2, ps, ump)
s.class(s1.1, s2$i9r, col = rainbow(11))