Complete beginner with R and I've looked around quite a bit but I can't find what I need. 

I have a for loop which iterates over a list of values. I want to put an if loop within that for loop, like this:

```
    for (i in list){
    if (i>200){
        print (i)
        }
    }

```

This returns the following warning:

"Warning message:
In if (i > 200) { :
 the condition has length > 1 and only the first element will be used"

and sure enough, the if loop only checks the condition on the very first element in the list.

I understand that this might be because the for loops don't return anything in R, but what's the workaround. How do I solve this?

Thanks for you help.