0

Imagine I have the following dataset.

D1

M2_ID   Year    Make    Gear Type   Bodyshape   Fuel Type   Type       Model    Engine Size Doors_Average
784     2015    BMW          M    Cabriolet      Petrol  BMW 3-Series   M320           3        2

D2

Year    Make    Segment  Model  Bodyshape   Fuel Type   Gear Type   Doors_Average
2008    BMW    4 Medium BMW 320  Cabrio      Diesel         M             2

Now I want to compare Cabriolet ( in D1) = Cabrio( in D2) Similarly , compare 320 ( in d1.type) = 320 (in D2.Model )

I have tried using

 m <- merge(d1,d2 by = c("year", "Make") 

I cannot understand how to combine ' by.x()' with 'by = c()'. Second: How to compare parts of the text like I explained above.
Edited: Added both sets. Explained better. Thank you for pointing out how to edit the question better.

lmo
  • 37,904
  • 9
  • 56
  • 69
Mehul Garg
  • 13
  • 4

0 Answers0