[R] match a task No. to a few person-IDs
    arun 
    smartpink111 at yahoo.com
       
    Fri Feb 15 14:15:19 CET 2013
    
    
  
Hi,
Try this:
dat1<- read.table(text="
      Task_No      Team   
A    49397        1         
B    49396        1
",sep="",header=TRUE)
dat2<- read.table(text="
    ID        Team
A 5019    1
B 472    1
C 140    1
D 5013    1
",sep="",header=TRUE)
 res1<- as.matrix(merge(dat1,dat2,by="Team"))
 row.names(res1)<-LETTERS[match(res1[,2],dat1[,1])]  
library(plyr)
res2<- as.matrix(join(dat1,dat2,by="Team"))
 row.names(res2)<-LETTERS[match(res2[,1],dat1[,1])]
 res2
#  Task_No Team   ID
#A   49397    1 5019
#A   49397    1  472
#A   49397    1  140
#A   49397    1 5013
#B   49396    1 5019
#B   49396    1  472
#B   49396    1  140
#B   49396    1 5013
A.K.
----- Original Message -----
From: Mat <matthias.weber at fnt.de>
To: r-help at r-project.org
Cc: 
Sent: Friday, February 15, 2013 4:45 AM
Subject: [R] match a task No. to a few person-IDs
hello together,
i have a task No. in a data.frame
       Task_No       Team    
A    49397         1          
B    49396         1      
and now i want to match my Person-IDs to each Task_No. My Person Ids look
like this one:
    ID        Team
A 5019    1
B 472    1
C 140    1
D 5013    1
The solution should be this:
       Task_No       Team     ID
A    49397         1               5019
A    49397         1               472
A    49397         1               140
A    49397         1               5013
B    49396         1         5019
B    49396         1            472
B    49396         1            140
B    49396         1            5013
perhabs anyone can help me.
Thank you
Mat
--
View this message in context: http://r.789695.n4.nabble.com/match-a-task-No-to-a-few-person-IDs-tp4658646.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
R-help at r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
    
    
More information about the R-help
mailing list