I have two dataframes:
info
Fname Lname
Henry H
Rose R
Jacob T
John O
Fred Y
Simon S
Gay T
And
students
Fname Lname Age Height Subject Result
Henry H 12 15 Math;Sci P
Rose R 11 18 Math;Sci P
Jacob T 11 15 Math;Sci P
Henry H 11 14 Math;Sci P
John O 12 13 Math;Sci P
John O 13 16 Math;Sci F
Fred Y 11 16 Sci P
Simon S 12 10 Eng;Math P
Gay T 12 11 Math;Sci F
Rose R 15 18 Math;Sci P
Fred Y 12 16 Math;Sci P
I want to do a JOIN and get all the names from info and find its relevant metadata from students. But only pick the one with the highest age (when Fname and LName are equal). My output should look like:
Final
Fname Lname Age Height Subject Result
Henry H 12 15 Math;Sci P
Rose R 15 18 Math;Sci P
Jacob T 11 15 Math;Sci P
John O 13 16 Math;Sci F
Fred Y 12 16 Math;Sci P
Simon S 12 10 Eng;Math P
Gay T 12 11 Math;Sci F
I have tried sqldf
but with no luck yet. I'm just not able to get the identifiers correctly. Is there any other way I can get my output?