I'm working with a data frame inside a function,and I have a problem in the syntaxis. This is the frame I'm working with:
c
id nobs
1 1 117
2 2 1041
3 3 243
4 4 474
5 5 402
6 6 228
7 7 442
8 8 192
9 9 275
10 10 148
And this is the code I'm using.
threshold=250
c
for (i in c[1]){
if(threshold > any(c[i,2])){
print(c[i,1])
}
}
What I want is to get the first element of the data frame is the condition is met, but I get the result: [1] 1 2 3 4 5 6 7 8 9 10. It only has to be: 1 3 6 8 10
Any help would be appreciated. Thanks in advance.