Hello I have 2 data frames:
d <- data.frame(v1 = c("A","B","C","D","E","F","G","H"),
v2 = c(1,2,3,4,5,6,7,8),
v3 = c(1,2,3,4,5,6,7,8)) )
m<-data.frame(v4 = c("B","H","A","C","D"))
I want to change the m in a way that m$v4 it will match the d$v1 and also create an m$v5 with the relative data of d$v2 and an m$v6 with the relative data of d$v3 based on the matching.
My final m data frame should look like this:
m
v4 v5 v6
1 B 2 2
2 H 8 8
3 A 1 1
4 C 3 3
5 D 4 4