a newbie here. I have a dataframe genes which contains two columns: Index and Name such as:
Index Name
1 A
2 B
3 C
4 D
Another dataframe similarity contains 6-7 columns one of which is Members which includes different Index values separated by a space such as:
Members
1 3 5 7
3 7
6 9 2
What I am trying to do is to replace the indices to Names by matching the index column from the dataframe genes. If the index is not found on genes, I simply want to put NA in its position.
So, based the example, my desired output is:
Members
A C NA NA
C NA
NA NA B.