2
I have several classes and each of these classes is composed of dozens of students, and each year these students change classes. So I would like to calculate the degree of grouping that a class keeps from one year to the next automatically. For example, in the year 2015 a school has two 1st grade classes, as below:
turma1a <- c('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J')
turma1b <- c('K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U')
And in the year 2016 these students moved to the 2nd grade in the year 2016 going to two new classes randomly, as below:
turma2a <- c('A', 'B', 'C', 'D', 'E', 'F', 'K', 'L', 'M', 'N')
turma2b <- c('O', 'P', 'Q', 'R', 'S', 'T', 'U', 'G', 'H', 'I', 'J')
In this way, I would like to determine that the turma1a
was 60% for the turma2a
and that the other was 63.63% for the 2b
.
I tried to do by intersection on R
, knowing which classes are more similar, but I would need to do it with dozens of classes compared to each other.
turma1a <- c('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J')
turma1b <- c('K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U')
turma2a <- c('A', 'B', 'C', 'D', 'E', 'F', 'K', 'L', 'M', 'N')
turma2b <- c('O', 'P', 'Q', 'R', 'S', 'T', 'U', 'G', 'H', 'I', 'J')
intersect(turma1a, turma2a)
[1] "A" "B" "C" "D" "E" "F"
With that script
, I meet the students in common, but I would need it to be automatic, because I need to analyze dozens of classes.