I'm a novice in R and need a simple method for this task. I have a first matrix A
[,1] [,2]
[1,] 1 "a"
[2,] 2 "b"
[3,] 3 "c"
[4,] 4 "d"
[5,] 5 "e"
[6,] 6 "f"
[7,] 7 "g"
[8,] 8 "h"
second matrix B
[,1] [,2]
[1,] 3 "t"
[2,] 5 "p"
[3,] 7 "n"
[4,] 8 "k"
[5,] 9 "mm"
I need to create matrix C
[,1] [,2] [,3]
[1,] 3 "c" "t"
[2,] 5 "e" "p"
[3,] 7 "g" "n"
[4,] 8 "h" "k"
I need to find common elements in first column in A and B matrix and create third matrix C with this common elements in first column, elements from matrix A in second column and elements from matrix B in third column.