title: List comprehension in R
body: <p>Is there a way to implement list comprehension in R?</p>
  
  <p>Like python:</p>
  
  <pre><code>sum([x for x in range(1000) if x % 3== 0 or x % 5== 0])
  </code></pre>
  
  <p>same in Haskell:</p>
  
  <pre><code>sum [x| x&lt;-[1..1000-1], x`mod` 3 ==0 || x `mod` 5 ==0 ]
  </code></pre>
  
  <p>What's the practical way to apply this in R?</p>
  
  <p>Nick</p>