Re: [R] grep(pattern = each element of a vector) ?

2013-09-12 Thread arun
-project.org Cc: Farrar, David farrar.da...@epa.gov; Green, Hyatt green.hy...@epa.gov; McManus, Michael mcmanus.mich...@epa.gov; Wahman, David wahman.da...@epa.gov Sent: Thursday, September 12, 2013 2:49 PM Subject: Re: [R] grep(pattern = each element of a vector) ? Jake, You can use the plyr

[R] grep(pattern = each element of a vector) ?

2013-09-12 Thread Beaulieu, Jake
Hi, I have a large dataframe that contains species names. I have a second dataframe that contains species names and some additional info, called 'Class', about each species. I would like match the species name is the first data frame with the 'Class' information contained in the second.

Re: [R] grep(pattern = each element of a vector) ?

2013-09-12 Thread Allen, Joel
Jake, You can use the plyr library or some form of apply. If you are on a 64bit system you can multithread and it goes much faster. something like this(for 32bit): require(plyr) df1 - data.frame(Taxa = c('blue', 'red', NA,'blue', 'red', NA,'blue', 'red', NA)) df2 - data.frame(Taxa = c( 'blue',