根据2列的查找值将数据框中的列添加到另一个列中

时间:2017-01-11 05:51:24

标签: r

我有2个数据帧,如下所示。我想根据第2列和第3列的查找值在DS1中附加DS2的第4列。

DS1

Entity  Service Type    Service Description Unit Price Incurred Volume    Total Service Charge in USD 
Entity1 WIRE & OTHER FUNDS TRNSF SVCS   CPO GP CUST MNT TEMP STORAGE    0.15    1024    153.6
Entity1 PAYMENT TRANSACTIONS    WIRE-HVC-LOCAL PAYMENT STP DR SHA   5.62    459 2579.58
Entity1 PAYMENT TRANSACTIONS    WIRE-HVC-LOCAL PAYMENT STP DR OUR   8.27    88  727.76
Entity1 PAYMENT TRANSACTIONS    FOREIGN WIRE PAYMENT STP DR SHA 19  40  760

DS2

Entity  Service Type    Service Description Unit Price Agreed
Entity1 WIRE & OTHER FUNDS TRNSF SVCS   CPO GP CUST MNT TEMP STORAGE    0.15
Entity1 PAYMENT TRANSACTIONS    WIRE-HVC-LOCAL PAYMENT STP DR SHA   5.62
Entity1 PAYMENT TRANSACTIONS    WIRE-HVC-LOCAL PAYMENT STP DR OUR   8.27
Entity1 PAYMENT TRANSACTIONS    FOREIGN WIRE PAYMENT STP DR SHA 15

我尝试了bcagd <- join(ctse1,bcagd, by = "Service Type"),但它抛出了一个未使用的错误参数。我在数据集中有很多行。请建议使用正确的功能。

0 个答案:

没有答案