[R-sig-eco] Combine elements in pairs from two data.frames
f.krah at mailbox.org
f.krah at mailbox.org
Fri Nov 11 16:04:15 CET 2016
something like this?
x <- cbind(c("a", "b", "c", "d"), 1:4)
y <- cbind(c("a", "a", "d"),c("b", "c", "a"))
t(apply(y, 1, function(z) x[match(z, x[,1]),2]))
> On 11 Nov 2016, at 15:49, Manoeli Lupatini <mlupatini at gmail.com> wrote:
>
> In the example below I have two datasets (A and B). I want to combine the
> elements in pair in DatasetA based on names in cells belong to ParentA and
> ParentB from DatasetB.
>
> Dataset A:
>
> Number Gene Crossing
> 601 BIO_14 CD/SINT
> 614 BIO_16 BIORA
> 2 TB_54 MANL
> 45 TU_85 SOSSEGO
>
> Dataset B:
>
> ParentA ParentB
> 601 614
> 601 2
> 45 601
>
> The result will be like this:
>
> Parents Genotype
> 601/614 BIO_14/BIO_16
> 601/2 BIO_14/TB_54
> 45/601 TU_85/BIO_14
>
> Thanks,
>
> Manoeli
>
> --
> Manoeli Lupatini
> Research Supervisor/Biotrigo Genética Ltda.
> Passo Fundo/RS/Brasil
> +55 55 91411174
> Agronomist
> MSc in Soil Science
> Dr in Soil Science
> Dr in Biology
> Perfil público
> https://br.linkedin.com/in/manoeli-lupatini-7a068943
>
> [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-ecology mailing list
> R-sig-ecology at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-ecology
[[alternative HTML version deleted]]
More information about the R-sig-ecology
mailing list