I have two tables, rfs19.122 and TAIR10Func. I am trying to find all matches between a column of each, and append the matches to one of the original tables. I came up with the for loop below, but it is quite slow. Is there a faster way to accomplish this?
n <-nrow(rfs19.122)
matches <- matrix()
for (row in 1:n) {
position<-grep(paste('^', rfs19.122$Gene[row], sep=''), TAIR10Func$Function)
matches[row]<-TAIR10Func$Function[position[1]]
}
rfs19.122$functions <-matches