Hi, You may try ?merge() or ?join() from library(plyr) dat1<- read.table(text=" Col1 Col2 red 1.23 blu 4.56 ",sep="",header=TRUE,stringsAsFactors=FALSE) dat2<- read.table(text=" Col1 Col2 red SQU blu CIR ",sep="",header=TRUE,stringsAsFactors=FALSE)
library(plyr) res1<-join(dat2,dat1,by="Col1")[,-1] colnames(res1)<- colnames(dat1) res1 # Col1 Col2 #1 SQU 1.23 #2 CIR 4.56 #or res2<-merge(dat2,dat1,by="Col1")[,-1] colnames(res2)<-colnames(dat1) res2 # Col1 Col2 #1 CIR 4.56 #2 SQU 1.23 A.K. Hi R wizards, Thanks in advance for your patience. I can't figure out how to replace values in one column with their equivalent values that are stored in another table. Any ideas? Data table Col1 Col 2 red 1.23 blu 4.56 Reference table Col1 Col2 red SQU blu CIR Desired Output Col1 Col2 SQU 1.23 CIR 4.56 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.