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 > >

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

2020-04-21 Thread Ana Marija
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 f

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

[R] How to merge two files

2011-07-04 Thread albert coster
Dear all, I have two files : seq.txt: NNATTAAAGGGC scores.txt : 0.8 0.7 0.3 0.5 0.6 0.5 0.01 0.9 0.3 0.8 I want output as following A 0.8 T 0.7 T 0.3 A 0.5 A 0.6 A 0.5 G 0.01 G 0.9 G 0.3 C 0.8 Where N are deleted and only A/T/G/C are appearing in a column. Thanks Albert 0.8 0.7 0.3