Entering edit mode
10.2 years ago
pnixsweet
•
0
How can I read in two tab delimited files and map them together by one common column(protein)?
protein_pathway.txt
Pathway Protein
Binding and Uptake of Ligands by Scavenger Receptors P69905
Erythrocytes take up carbon dioxide and release oxygen P69905
Metabolism P69905
Amyloids P02647
Metabolism P02647
Hemostasis P68871
protein_gene.txt
Gene Protein
Fabp3 P11404
HBA1 P69905
APOA1 P02647
Hbb-b1 P02088
HBB P68871
Hba P01942
datafile1 <- read.csv("c:/gene.csv", header=T, sep=",")
datafile2 <- read.csv("c:/pathway.csv", header=T, sep=",")
dim(datafile1)
dim(datafile2)
datafile <- rbind(datafile1,datafile2)
dim(datafile)
write.csv(datafile,"c:/datafile.csv")
This only gives me the merged (appended one). How can map by a common column protein here?
and
help(merge)
if you want to to it like a database joinAnd when merge() gets slow due to absolutely huge datasets: