如果条目与另一列R匹配,则在数据框中交换单元格

时间:2018-10-02 20:53:49

标签: r

我有两个数据框:

start<- data.frame(gene=c("A","A","A","B","B"), isoform=c("A.1","A.1","A.1","B.1","B.1"), exon=c("1","2","3","1","2"))

replace<-data.frame(isoform=c("A.1","B.1"),gene=c("C","D"))

我想将df1中的基因条目与df2中与同种型匹配的基因条目互换 即以

结尾
result<-data.frame(gene=c("C","C","C","D","D"), isoform=c("A.1","A.1","A.1","B.1","B.1"), exon=c("1","2","3","1","2"))

0 个答案:

没有答案