title: Create a formula using row names in R
body: <p>I am sorry about the title, I dont know how to describe my problem in a different way.</p>
  
  <p>I have two dataframes:</p>
  
  <pre><code>set.seed(5)
  
  Estimate_list = rnorm(7) 
  Tvalue_list = rnorm(7) 
  
  df1 = data.frame(Estimate = Estimate_list, Tvalue = Tvalue_list)
  rownames(df1) &lt;- c("Intercept", "ABC$V2", "ABC$V6", "ABC$V9", "ABC$V22", "ABC$V25", "ABC$V31")
  
  
  set.seed(7)
  
  df2 = data.frame(V1 = rnorm(3), V2 = rnorm(3),  V6 = rnorm(3), V8 = rnorm(3), V9 = rnorm(3),  V10 = rnorm(3),
               V14 = rnorm(3), V22 = rnorm(3), V25 = rnorm(3), V27 = rnorm(3), V31 = rnorm(3), V36 = rnorm(3))
  </code></pre>
  
  <p>I want to find an automatic way to do this:</p>
  
  <pre><code>Val_df1 = df1[1,1] + 
  df1[2,1]*df2$V2  + df1[3,1]*df2$V6 + 
  df1[4,1]*df2$V9  + df1[5,1]*df2$V22 +
  df1[6,1]*df2$V25 + df1[7,1]*df2$V31 
  </code></pre>
  
  <p>Basically I want use the first entry in df1 and then go down the first column in df1 and multiply the values with the columns in df2. But I only want to use the columns of df2, whose names are listed as part of the row names in df1. </p>
  
  <p>Any ideas how to easily do tht automatically? Until now I typed everything manually, but its getting too much.</p>