Subset data frame by similar elements from rows and column between two data frames
You can take the PATIENT_ID from the first dataframe and use them to select from your second dataframe. Than transpose, so something like this:

ID_Names &lt;- First_df$PATIENT_ID

rownames(Second_df) &lt;- Second_df$Hugo_Symbol

Selected_df &lt;- Second_df[, ID_Names]

Expected_df &lt;- t(Selected_df)