Implementing parallel computation in R