Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Locus S1 S2 S3
- loc1 87 56 77
- loc2 34 55 75
- loc3 12 09 78
- loc4 34 67 89
- loc5 78 65 46
- Locus S1 S2 S3
- loc3 13 43 34
- loc5 43 56 90
- loc7 89 56 33
- loc1 56 88 00
- loc4 66 77 98
- loc2 34 44 66
- Locus S1 S2 S3
- loc1 56 88 00
- loc2 34 44 66
- loc3 13 43 34
- loc4 66 77 98
- loc5 43 56 90
- file1 <-read.delim(file="file1.txt",header=TRUE,sep="t")
- file2 <-read.delim(file="file2.txt",header=TRUE,sep="t")
- new_output <- file1[file1$Locus %in% file2$Locus,]
- write.table(new_output,file="new_output.txt",sep="t")
- merge(file1["Locus"], file2, by = "Locus")
- # Locus S1 S2 S3
- #1 loc1 56 88 0
- #2 loc2 34 44 66
- #3 loc3 13 43 34
- #4 loc4 66 77 98
- #5 loc5 43 56 90
- new_output <- file2[match(file1$Locus, file2$Locus), ]
- file1 <-read.delim(file = "file1.txt", header = TRUE, sep = "t", row.names = 1)
- file2 <-read.delim(file = "file2.txt", header = TRUE, sep = "t", row.names = 1)
- new_output <- file2[rownames(file1$Locus), ]
Add Comment
Please, Sign In to add comment