# Cross Table with conditon

#### aleplgr

##### New Member
Hello, I have the following data

Code:
LOGIN,IMPROVE,EXECNUMBER,RESULT
1002,NO,1,0
1002,NO,2,0
1002,NO,3,0
1002,NO,4,0
1002,NO,5,0
1002,NO,6,0
1002,NO,7,0
1002,NO,8,0
1002,NO,9,0
1002,NO,10,0
1002,NO,11,0
1002,NO,12,26
1002,NO,13,61
1002,NO,14,29
1002,NO,15,30
1002,NO,16,36
1002,NO,17,44
1002,NO,18,36
1002,NO,19,33
1002,NO,20,39
1002,NO,21,44
1002,NO,22,40
1002,NO,23,57
1002,NO,24,61
1002,NO,25,57
1002,NO,26,29
1002,NO,27,33
1002,NO,28,61
1002,NO,29,57
1002,NO,30,30
1002,NO,31,53
1002,NO,32,33
1002,NO,33,53
1002,NO,34,40
1002,NO,35,53
1002,NO,36,45
1002,NO,37,57
1002,NO,38,51
1002,NO,39,47
1002,NO,40,47
1002,NO,41,57
1002,NO,42,43
1002,NO,43,0
1002,NO,44,40
1002,NO,45,66
1002,NO,46,27
1002,NO,47,35
1002,NO,48,61
1002,NO,49,22
1002,NO,50,34
1002,NO,51,61
1002,NO,52,50
1002,NO,53,60
1002,NO,54,40
1002,NO,55,34
1002,NO,56,28
1002,NO,57,39
1002,NO,58,32
1003,YES,1,0
1003,YES,2,0
1004,YES,1,0
1004,YES,2,0
1004,YES,3,0
1004,YES,4,0
1006,YES,1,0
1006,YES,2,0
1006,YES,3,0
1006,YES,4,0
1006,YES,5,0
1006,YES,6,0
1006,YES,7,0
1006,YES,8,0
1006,YES,9,0
1007,NO,1,0
1007,NO,2,0
1007,NO,3,0
1007,NO,4,0
1007,NO,5,0
1007,NO,6,0
1007,NO,7,0
1007,NO,8,0
1007,NO,9,0
1007,NO,10,0
1008,YES,1,0
1008,YES,2,0
1008,YES,3,0
1008,YES,4,0
1008,YES,5,0
1012,YES,1,0
1013,YES,1,4
1013,YES,2,34
1013,YES,3,34
1013,YES,4,30
1013,YES,5,50
1013,YES,6,23
1013,YES,7,42
1013,YES,8,36
1013,YES,9,50
1013,YES,10,20
1013,YES,11,57
1013,YES,12,32
1013,YES,13,47
1013,YES,14,57
1013,YES,15,50
1013,YES,16,30
1014,YES,1,0
1014,YES,2,0
1014,YES,3,0
1014,YES,4,0
1014,YES,5,0
1014,YES,6,0
1014,YES,7,0
1014,YES,8,0
1014,YES,9,0
1014,YES,10,0
1014,YES,11,0
1014,YES,12,0
1014,YES,13,0
1014,YES,14,34
1014,YES,15,57
1014,YES,16,36
1014,YES,17,0
1015,NO,1,0
1015,NO,2,0
1015,NO,3,0
1015,NO,4,0
1015,NO,5,0
1015,NO,6,0
1015,NO,7,0
1015,NO,8,0
1015,NO,9,0
1015,NO,10,0
1015,NO,11,25
1015,NO,12,21
1015,NO,13,33
1015,NO,14,29
1015,NO,15,25
1015,NO,16,40
1015,NO,17,36
1015,NO,18,28
1015,NO,19,47
1015,NO,20,44
1015,NO,21,29
1015,NO,22,19
1015,NO,23,8
1015,NO,24,28
1015,NO,25,47
1015,NO,26,29
1015,NO,27,32
1015,NO,28,16
1015,NO,29,28
1015,NO,30,18
1015,NO,31,36
1015,NO,32,13
1015,NO,33,47
1015,NO,34,27
1016,NO,1,0
1016,NO,2,0
1016,NO,3,0
1016,NO,4,0
1016,NO,5,0
1016,NO,6,0
1016,NO,7,0
1016,NO,8,0
1016,NO,9,0
1016,NO,10,0
1016,NO,11,0
1016,NO,12,0
1016,NO,13,0
1016,NO,14,0
1016,NO,15,0
1016,NO,16,0
1016,NO,17,0
1016,NO,18,0
1016,NO,19,26
1016,NO,20,21
1016,NO,21,22
1016,NO,22,21
1016,NO,23,28
1016,NO,24,30
1016,NO,25,20
describing participants executions of an exercise and improving after those executions. LOGIN is the participant identifier, IMPROVE shows if the particpant improved or not, RESULT ranges from 0 to 66 and is the result of each execution and EXECNUMBER is the execution number of the exercise (meaning first execution, second execution, etc) .

I need to build a cross table with RESULT in X exe (from 0 to 66) and EXECNUMBER on Y exe (from 1 to 58) which I did using this code

Code:
> myData <- read.csv(file='data.csv',sep=',',header=T)
> res <- table(myData$EXECNUMBER,myData$RESULT)
But now I was asked to fill the table with the proportion of people with IMPROVE=YES

Being:
Code:
n number of participants for each execution number and for each result.
m number of participants for each execution number and for each result and IMPROVE=YES
I need to fill the table with m/n