R - use of foreach() for list comprehension

21 Jan 2018

Use foreach and %:% similar to python list comprehension

x <- foreach(a=irnorm(1, count=10), .combine='c') %:% when(a >= 0) %do% sqrt(a)
[ R  function  parallelization  loop  ]