I have a dataset like this:
X Y A B C
1 1 2010 1 1 44
2 1 2010 1 2 17
3 1 2010 1 3 0
4 1 2010 1 4 0
5 1 2010 1 5 0
6 1 2010 1 6 0
...
My aim is to take the values in C that correspond to X==1&Y==2006&A==seq(1,19)&B==19.
I thought I should use a While loop making something like this:
for (i in 1:19){
while (X==1){
while (Y==2006){
while (B==19){
x[i]<-A[i]
}
}
}
}
Nonetheless, the code above doesn't work and there are always warnings() like "the condition has length > 1 and only the first element will be used" Can anyone help?