this solved it:
 m=merge(a,b,by="ID_1",all.y = T)

On Tue, Apr 21, 2020 at 9:53 AM Ana Marija <sokovic.anamar...@gmail.com> wrote:
>
> Hello,
>
> > head(a)
>            ID_1 pheno
> 1             0     B
> 2 fam1000_G1000     0
> 3 fam1001_G1001     0
> 4 fam1003_G1003     1
> 5 fam1005_G1005     0
> 6 fam1009_G1009     0
> > head(b)
>            ID_1          ID_2 missing
> 1             0             0       0
> 2 fam1000_G1000 fam1000_G1000       0
> 3 fam1001_G1001 fam1001_G1001       0
> 4 fam1003_G1003 fam1003_G1003       0
> 5 fam1005_G1005 fam1005_G1005       0
> 6 fam1009_G1009 fam1009_G1009       0
> > dim(b)
> [1] 1602    3
> > dim(a)
> [1] 1652    2
> > m=merge(a,b,by="ID_1")
> > dim(m)
> [1] 1499    4
> > head(m)
>           ID_1 pheno         ID_2 missing
> 1            0     B            0       0
> 2 fam0110_G110     1 fam0110_G110       0
> 3 fam0117_G117     1 fam0117_G117       0
> 4 fam0124_G124  <NA> fam0124_G124       0
>
> I would like my merged file (m) to have the same number of lines like
> (b), that is 1602. Can you please let me know how would I do that?
>
> Thanks
> Ana

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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