Archive for November, 2008

finding common elements in R

Thursday, November 6th, 2008

I used to write a lengthy function to locate the commen elements of two arrays. It turns out there is a much simpler solution:

id <- which(array1 %in% array2) if (length(id)>0) {
comm <- array1[id] } else { cat("No common elements!\n") }

R could be paralleled

Saturday, November 1st, 2008

I just learned that R can do parallel calculation. Bingo! Here is the link.