[R] match from a data.frame in dependence of an ID
arun
smartpink111 at yahoo.com
Sat Mar 29 17:44:34 CET 2014
Hi,
Try:
#dat is the dataset:
library(plyr)
dcast(dat,ID~Group,value.var="value",fill="")
#or
dcast(dat,ID~Group,value.var="value",fill=0)
A.K.
On Friday, March 28, 2014 4:54 AM, Mat <matthias.weber at fnt.de> wrote:
Hello togehter,
i have a litte problem. I have an output data.frame which look like this
one:
ID
1 10
2 11
3 12
Now I have another data.frame with more than one line for each ID:
ID Group Value
1 10 1 10
2 10 2 20
3 10 3 30
4 10 4 40
5 10 5 50
6 11 3 60
7 11 4 70
8 12 4 80
How can i match these two data.frame for the following result:
ID 1 2 3 4 5
1 10 10 20 30 40 50
2 11 60 70
3 12 80
--
View this message in context: http://r.789695.n4.nabble.com/match-from-a-data-frame-in-dependence-of-an-ID-tp4687745.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