[R] match from a data.frame in dependence of an ID
Mat
matthias.weber at fnt.de
Fri Mar 28 16:07:42 CET 2014
Thanks first. Your solutions works nearly perfect, i only have one problem
left.
The result looks like perfect, my problem is now, that i want to convert the
solution into a data.frame.
If i try
test<-xtabs(df2$Value~df2$ID + df2$Group)
test
df2$Group
df2$ID 1 2 3 4 5
10 10 20 30 40 50
11 0 0 60 70 0
12 0 0 0 80 0
perfect.
Now i try:
test<-as.data.frame(test)
test
df2.ID df2.Group Freq
1 10 1 10
2 11 1 0
3 12 1 0
4 10 2 20
5 11 2 0
6 12 2 0
7 10 3 30
8 11 3 60
9 12 3 0
10 10 4 40
11 11 4 70
12 12 4 80
13 10 5 50
14 11 5 0
15 12 5 0
Maybe i can delete the entries on the top "df2$Group" and "df2$ID"?
My solution should like this one, that i can convert into a data.frame
ID 1 2 3 4 5
1 10 10 20 30 40 50
2 11 0 0 60 70 0
3 12 0 0 0 80 0
Thank you
Mat
--
View this message in context: http://r.789695.n4.nabble.com/match-from-a-data-frame-in-dependence-of-an-ID-tp4687745p4687767.html
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list