This is what I'm trying to code for in R...
Let's say I have 50 rows and 4 columns. If the value in (row 1, column 2) was greater than 5, then count the value in (row 1, column 4).
For an example: (row,column)
If (1,2) = (6) then count the value in (1,4)
If (2,2) = (8) then count the value in (2,4)
If (3,2) = (4) then DO NOT count the value in (3,4)
And so on....Then add the all the values from column 4.
How would I code this in R? I've tried creating a function, looping, if statements, etc.
Aucun commentaire:
Enregistrer un commentaire