I have a data set like this
df1<-data.frame(ID=c(1,2,3,4),colA=c(101,102,103,104),colB=c(201,202,203,204))
df2<-data.frame(var_id=c(101,102,103,104,201,202,203,204),var_value=c("A","B","C","D","E","F","G","H"))
I want to map any value in df1 that is in df2$var_id with the corresponding string in df2$var_value.
Desired output
df1<-data.frame(ID=c(1,2,3,4),colA=c("A","B","C","D"),colB=c("E","F","G","H"))
I have tried write a function, and then do lapply, but it only display one var_value