Hi everyone,
I have a programming question and I want this to be done in R. I have two data frames. The df1
has first three columns as header line and the file is in xlsx format. The second data frame has first line as a header. I want to search the genes from the first line of df1
along with their corresponding mutation to match the genes and mutation in df2
and extract the corresponding values. I want the corresponding values to be inserted in the sample line (I have indicated those columns with *
). Also I am not concerned anything with the columns indicated by X. I am a beginner in programming and would really appreciate if you guys could help me get this done. Thank you.
df1:
Gene MPK MPKK MPKKK
Mutation D888H T66S D44G
Sample * * *
1 X X X
2 X X X
3 X X X
df2:
Gene Values Mutation
MPK 211 D888H
MPKK 443 T66S
MPK 44 D334G
MPKK 222 S434G
MPKKK 223 D44G
I want this Output:
Gene MPK MPKK MPKKK
Mutation D888H T66S D44G
Sample 211 443 223
1 X X X
2 X X X
3 X X X
A 2 line (that could be 1) version:
For really large matches,
inner_join
/left_join
/etc. from dplyr are more efficient. Note that I used the first line as a header, though one could easily modify things were that not the case.Hi everyone
Could you please help me on this error, after running above for loop I have below error:
Any help would appreciated!
Thanks