text: user285: My first data frame whose first column i intend to use which is PATIENT_ID
  PATIENT_ID  SEX RACE    FAB AGE BM_BLAST_PERCENTAGE WBC
  TCGA-AB-2805    Male    WHITE   M0  77  67  92
  TCGA-AB-2822    Male    WHITE   M0  65  99  2.9
  TCGA-AB-2831    Male    WHITE   M0  59  61  1.4
  TCGA-AB-2890    Male    NH/C    M0  69  60  6.1
  TCGA-AB-2907    Male    WHITE   M0  69  82  1.6
  TCGA-AB-2913    Male    WHITE   M0  61  95  61.6
  TCGA-AB-2922    Male    WHITE   M0  83  75  77.9
  TCGA-AB-2936    Female  NH/C    M0  60  50  2.1
  
  My second data frame where i have the respective patient ID as individual column with expression values 
  Hugo_Symbol TCGA-AB-2803    TCGA-AB-2805    TCGA-AB-2806    TCGA-AB-2807    TCGA-AB-2808
  A1BG    0   0   0   0   0
  A1CF    0   0   0   0   0
  A2BP1   71.4095 48.5475 50.8339 45.7498 47.1328
  A2LD1   2.0576  3.3467  5.7288  0.993   5.4988
  A2ML1   467.0782    16.0643 7.0019  343.5948    255.9152
  A2M 11.3169 0.6693  17.823  116.1867    182.2467
  A4GALT  0   2.6774  1.2731  4.9652  0.7855
  A4GNT   0   0   0   0   0
  AAA1    514.4033    532.7979    504.1375    697.1202    443.8335
  AAAS    0   0   0   0   0
  AACSL   190.3292    74.2972 84.6595 559.0864    317.3606
  AACS    0   0   0   1.9861  0
  AADACL2 0   0   0   0   0
  AADACL3 0   0   0   0   0
  AADACL4 1.0288  0   0.6365  0   0
  
  What I tried so far transposing the second data frame so that i can get the individual column as my first column ,and subset by using dplyr library but so far im not able to ..any help or suggestion how to do it would be highly appreciable 
  I would like to have my expected data frame as such 
  PATIENT_ID  Gene B  GeneA   GeneC   GeneA   GeneA 
  TCGA-AB-2803-03 0   0   0   92.5926 876.5432
  TCGA-AB-2805-03 0.6693  1.3387  0   92.6305 421.6867
  TCGA-AB-2806-03 0   14.1884 16.3654 119.599 625.0796
  TCGA-AB-2807-03 2.006   9.3247  13.5154 178.4211    537.2393
  TCGA-AB-2808-03 0   42.3016 28.3975 170.2042    653.5742
  TCGA-AB-2810-03 0   1.5668  8.9665  152.0747    1087.5648
  TCGA-AB-2811-03 0   0   6.9556  30.3103 1414.6602
  TCGA-AB-2812-03 0   14.3289 11.9466 120.3591    962.5575
  TCGA-AB-2813-03 0   3.4938  1.3813  51.1883 594.7593
  TCGA-AB-2814-03 0   56.8659 118.7051    87.1817 472.6912
  TCGA-AB-2815-03 0   2.0692  3.6986  104.6575    502.5234
  
  
  user2632: If you're still looking for an answer on this, I would use the gather and spread functions in the tidyr package (part of the tidyverse suite of packages - which also includes dplyr and ggplot2:
  library(tidyverse) 
  df2_long <- gather(PATIENT_ID, value, -Hugo_Symbol)
  df1 %>% 
    left_join(df2_long) %>%   # merges the 2 data frames together
    spread(Hugo_Symbol, value)
  
  
  user939: 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 <- First_df$PATIENT_ID
  
  rownames(Second_df) <- Second_df$Hugo_Symbol
  
  Selected_df <- Second_df[, ID_Names]
  
  Expected_df <- t(Selected_df)
  
  
original_text: 285: <p>My first data frame whose first column i intend to use which is PATIENT_ID</p>
  
  <pre><code>PATIENT_ID  SEX RACE    FAB AGE BM_BLAST_PERCENTAGE WBC
  TCGA-AB-2805    Male    WHITE   M0  77  67  92
  TCGA-AB-2822    Male    WHITE   M0  65  99  2.9
  TCGA-AB-2831    Male    WHITE   M0  59  61  1.4
  TCGA-AB-2890    Male    NH/C    M0  69  60  6.1
  TCGA-AB-2907    Male    WHITE   M0  69  82  1.6
  TCGA-AB-2913    Male    WHITE   M0  61  95  61.6
  TCGA-AB-2922    Male    WHITE   M0  83  75  77.9
  TCGA-AB-2936    Female  NH/C    M0  60  50  2.1
  </code></pre>
  
  <p>My second data frame where i have the respective patient ID as individual column with expression values </p>
  
  <pre><code>Hugo_Symbol TCGA-AB-2803    TCGA-AB-2805    TCGA-AB-2806    TCGA-AB-2807    TCGA-AB-2808
  A1BG    0   0   0   0   0
  A1CF    0   0   0   0   0
  A2BP1   71.4095 48.5475 50.8339 45.7498 47.1328
  A2LD1   2.0576  3.3467  5.7288  0.993   5.4988
  A2ML1   467.0782    16.0643 7.0019  343.5948    255.9152
  A2M 11.3169 0.6693  17.823  116.1867    182.2467
  A4GALT  0   2.6774  1.2731  4.9652  0.7855
  A4GNT   0   0   0   0   0
  AAA1    514.4033    532.7979    504.1375    697.1202    443.8335
  AAAS    0   0   0   0   0
  AACSL   190.3292    74.2972 84.6595 559.0864    317.3606
  AACS    0   0   0   1.9861  0
  AADACL2 0   0   0   0   0
  AADACL3 0   0   0   0   0
  AADACL4 1.0288  0   0.6365  0   0
  </code></pre>
  
  <p>What I tried so far transposing the second data frame so that i can get the individual column as my first column ,and subset by using dplyr library but so far im not able to ..any help or suggestion how to do it would be highly appreciable </p>
  
  <p>I would like to have my expected data frame as such </p>
  
  <pre><code>PATIENT_ID  Gene B  GeneA   GeneC   GeneA   GeneA 
  TCGA-AB-2803-03 0   0   0   92.5926 876.5432
  TCGA-AB-2805-03 0.6693  1.3387  0   92.6305 421.6867
  TCGA-AB-2806-03 0   14.1884 16.3654 119.599 625.0796
  TCGA-AB-2807-03 2.006   9.3247  13.5154 178.4211    537.2393
  TCGA-AB-2808-03 0   42.3016 28.3975 170.2042    653.5742
  TCGA-AB-2810-03 0   1.5668  8.9665  152.0747    1087.5648
  TCGA-AB-2811-03 0   0   6.9556  30.3103 1414.6602
  TCGA-AB-2812-03 0   14.3289 11.9466 120.3591    962.5575
  TCGA-AB-2813-03 0   3.4938  1.3813  51.1883 594.7593
  TCGA-AB-2814-03 0   56.8659 118.7051    87.1817 472.6912
  TCGA-AB-2815-03 0   2.0692  3.6986  104.6575    502.5234
  </code></pre>
   2632: <p>If you're still looking for an answer on this, I would use the <code>gather</code> and <code>spread</code> functions in the <code>tidyr</code> package (part of the <code>tidyverse</code> suite of packages - which also includes <code>dplyr</code> and <code>ggplot2</code>:</p>
  
  <pre><code>library(tidyverse) 
  df2_long &lt;- gather(PATIENT_ID, value, -Hugo_Symbol)
  df1 %&gt;% 
    left_join(df2_long) %&gt;%   # merges the 2 data frames together
    spread(Hugo_Symbol, value)
  </code></pre>
   939: <p>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:</p>
  
  <pre><code>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)
  </code></pre>
  