0

I have one data frame that has five columns (fips, SCC, Emissions, County, Solvent) and another data frame that corresponds to these five columns (fips, SCC, Pollutant, Emissions, type, year). I am wanting to grab the year from the second data set and add it as a column to the other one.

I was thinking the best way to do it would be to look at both the Emissions and SCC as these together should create a unique identifier. Then I can get the index of where these match together, and then create a function that returns the corresponding year , and finally use sapply to get all of the years in the correct order. Can someone let me know how I can get the correct row index?

Ashlee Berry
  • 75
  • 1
  • 7
  • See the linked question on how to merge/join such data. If you are not able to solve your problem with that information, please post a question that includes a [reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example/5963610) and describes what you have tried. This will make it much easier for others to help you. – Jaap Oct 18 '16 at 21:44
  • That worked very well, thanks for pointing me in the right direction. I was massively over complicating it, didn't realize there was a built in function that does this. – Ashlee Berry Oct 19 '16 at 01:19

0 Answers0