R的merge用法(2018-06-05)

R语言-merge函数

merge函数的声明:

merge( x, y, by = intersect(names(x), names(y)),
by.x = by, by.y = by, all = FALSE, all.x = all, all.y = all,
sort = TRUE, suffixes = c(".x",".y"),
incomparables = NULL, ...)

#merge过程中两个文件匹配行一致,不然会报错。

DF1<-read.csv("lyr/rna-seq/blast/geneID/gene.csv") #读取gene.csv
DF2<-read.csv("lyr/rna-seq/blast/geneID/db_blast3.csv") #读取db_blast3.csv
dim(DF1) #看一下表格维度
dim(DF2)
merge(DF1,DF2,by ="RNA_nucleotide_accession.version", all.y = TRUE)
data1<-(merge(DF1,DF2,by ="RNA_nucleotide_accession.version", all.y = TRUE)) #将merge结果写道data中
write.csv(data1, file = "result_data.csv", quote = FALSE, row.names = FALSE) #输出文件为result_data.csv

接着看result_data.csv中基因的功能。

你可能感兴趣的:(R的merge用法(2018-06-05))