Try xtabs()
>> df2 = data.frame(ID = c(10,10,10,10,10,11,11,12),Group =
c(1,2,3,4,5,3,4,4),Value = c(10,20,30,40,50,60,70,80))
>> xtabs(df2$Value~df2$ID + df2$Group)

I think this is exactly what you want.


On Fri, Mar 28, 2014 at 4:51 PM, Mat <matthias.we...@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@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.
>

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to