Re: [R] how to merge two files while preserving the number of rows of one file in merged one?

2020-04-21 Thread Jeff Newmiller
Read about the all.x and all.y arguments to ?merge. On April 21, 2020 7:53:33 AM PDT, Ana Marija 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)

Re: [R] how to merge two files while preserving the number of rows of one file in merged one?

2020-04-21 Thread Ana Marija
this solved it: m=merge(a,b,by="ID_1",all.y = T) On Tue, Apr 21, 2020 at 9:53 AM Ana Marija 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 > >

Re: [R] How to merge two files

2011-07-04 Thread Joshua Wiley
Dear Albert, Here is one way: tmp.scores <- readLines("~/scores.txt") tmp.seq <- readLines("~/seq.txt") tmp.seq <- strsplit(gsub("N", "", tmp.seq), "")[[1]] genedat <- data.frame(Sequence = tmp.seq, Scores = as.numeric(tmp.scores)) ## Yields > genedat Sequence Scores 1 A 0.80 2