[R] match a task No. to a few person-IDs

Rui Barradas ruipbarradas at sapo.pt
Fri Feb 15 15:38:09 CET 2013


Hello,

Use ?merge.


tasks <- read.table(text = "
     Task_No       Team
A    49397	     1	
B    49396	     1  	
", header = TRUE)

ids <- read.table(text = "
     ID        Team
A 5019  1
B 472  1
C 140  1
D 5013  1
", header = TRUE)


merge(tasks, ids, all.x = TRUE)


Hope this helps,

Rui Barradas

Em 15-02-2013 09:45, Mat escreveu:
> 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