Thanks to the encouragement from Sky, I go on doing a simple test on the package doSNOW, which is said to be useful for parallel computing (although the meaning of "parallel" is still not clear to me…

).
My PC has two cores. Following the article’s simple code:
############################
library(doSNOW)
cl<-makeCluster(2) # I have two cores
registerDoSNOW(cl)
# create a function to run in each itteration of the loop
check <-function(n) {
for(i in 1:100){
sme <- matrix(rnorm(1000), 10,10)
a <- solve(sme)
}
}
times <- 100 # times to run the loop
system.time( x <- foreach(j=1:times ) %dopar% check(j) )
user system elapsed
0.07 0.01 1.97
system.time(for(j in 1:times ) x <- check(j))
user system elapsed
3.62 0.00 3.63
#############################
I tried this code for several times and found that the time saved by "foreach" depends on how many cores you have. If you have n cores, you probably will have 1/n time as before when doing iterations using "for".
Btw, it is wired to see doSNOW not work in a Linux environment. I am not sure about this problem. But I use another similar package called "doMC" to see how much faster when I have 4 cores.
#####################################
library(doMC)
registerDoMC( ) # different from doSNOW
times <- 1000 # a large iteration time
system.time( x <- foreach(j=1:times ) %dopar% check(j) ) # check() is the same as before
user system elapsed
345.391 344.743 124.229
system.time(for(j in 1:times ) x <- check(j))
user system elapsed
459.271 1.165 460.698
#####################################
So, although I have not found much solutions in large dataset in doSNOW or doMC so far, at least when I do large simulations in future, "foreach" could be one choice to make my code run faster.
PS: If I remember right, our department has an 8-core sever, which means we could save a lot on time using foreach.