1

I have two large datasets. Here is the format:

First:

Data Date     Ticker.  Revenue

x1               y1        z1
x10              y10       z10
...             ...      ...

Second:

Data Date     Ticker.  Price

x1               y1        p1
x2               y2        p2
...              ...       ...
x10              y10       p10
...              ...       ...

I want to search the second dataset to find corresponding values of Price and insert it in first dataset. So the final dataset would be:

Data Date     Ticker.  Revenue.  Price

x1               y1        z1      p1
x10              y10       z10     p10
...             ...      ...

azmath
  • 97
  • 6

1 Answers1

1

We can use merge

merge(df1, df2, by = c("Date", "Ticker"))
akrun
  • 874,273
  • 37
  • 540
  • 662
  • Thank you, but it should include other variables in df. I gave revenue as an example, but it should include everything else – azmath Oct 12 '20 at 23:46
  • @azmath it would include all the other columns except the 'Date' and 'Ticker' that is common to both – akrun Oct 12 '20 at 23:47