[R] Odp: merge
Petr PIKAL
petr.pikal at precheza.cz
Fri Apr 16 14:24:49 CEST 2010
Hi
r-help-bounces at r-project.org napsal dne 16.04.2010 14:00:09:
> I have a problem with the merge command.
> I have to merge two dataframe that looks like the following example:
>
> CODPROD N1 N3 N4
> 23 3 55 4
> 24 5 67 36
> 25 3 73 24
>
>
>
> second data frame
>
>
> CODPROD N1 N2
> 30 34 45
> 45 0 78
> 65 0 56
>
>
> The result should be:
>
> CODPROD N1 N2 N3 N4
> 23 3 NA 55 4
> 24 5 NA 67 36
> 25 3 NA 73 24
> 30 34 45 NA NA
> 45 0 78 NA NA
> 65 0 56 NA NA
merge(data1, data2, by="CODPROD", all=T)
should work. So what does not work in your case?
Regards
Petr
>
> Anyone knows how to do it??
>
> ______________________________________________
> 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