Thank you so much Arun:)
On Wednesday, February 19, 2014 6:06 PM, arun <smartpink111@yahoo.com>
wrote:
Hi Farnoosh,
Try:
library(plyr)
res <-
join(`DATA-A`,`DATA-B`,by="Var1",type="right")[,c(3,1:2,4)]
head(res)
# ID Var1 Var2 var3
#1 1 AETNA CARDINAL CARE TIER 2 <NA> 10
#2 2 AETNA EPO Group1 110
#3 3 BLUE CARD INTE Group1 2
#4 4 BLUE CROSS AUTO Group1 25
#5 5 BLUE CROSS CA Group1 33
#6 6 LOCKHEED Group2 40
A.K.
On Wednesday, February 19, 2014 6:03 PM, farnoosh sheikhi
<farnoosh_81@yahoo.com> wrote:
Hi Arun,
I have two data files, DataA looks like below. I need to add Var2 to DataB (2nd
data set), but not sure if I can just merge based on Var1.
Thanks for your help.
DATA-A:
Var1 Var2
AETNA AF Group1
AETNA BAY Group1
AETNA BMT Group1
AETNA BR Group1
AETNA CARE Group1
AETNA TIER 2 Group1
AETNA EPO Group1
BLUE CARD INTE Group1
BLUE CROSS AUTO Group1
BLUE CROSS CA Group1
LOCKHEED Group2
OPEN PLAN Group2
MED GRP Group2
MED FOUNDATION Group2
AETNA PMG OF SAN JOSE Group2
DATA-B:
ID Var1 var3
1 AETNA CARDINAL CARE TIER 2 10
2 AETNA EPO 110
3 BLUE CARD INTE 2
4 BLUE CROSS AUTO 25
5 BLUE CROSS CA 33
6 LOCKHEED 40
7 OPEN PLAN 55
8 MED GRP 1
9 MED FOUNDATION 1
10 AETNA PMG OF SAN JOSE 0
11 AETNA AF 22
12 AETNA BAY 333
13 AETNA BMT 22
14 AETNA BR 22
15 BLUE CARD INTE 11
16 BLUE CARD INTE 10
Regards, Farnoosh Sheikhi
[[alternative HTML version deleted]]