title: pass each row of a data frame of variable names (character strings) into a 'select' function, iteratively
body: <p>I have a data frame of combinations of variable names, each of which is a column name in a larger data frame of numeric data. It looks like this.</p>
  <pre><code># A tibble: 63 x 3
     Var1                                    Var2             Var3                 
     &lt;fct&gt;                                   &lt;fct&gt;            &lt;fct&gt;                
   1 Combined_t2|t1_lag8                     mean_RT_200_all  dual_average_accuracy
   2 Combined_abmag_t2_lag8_minus_lag3       mean_RT_200_all  dual_average_accuracy
   3 Combined_abmag_t2_1.0_minus_lag3        mean_RT_200_all  dual_average_accuracy
   4 Combined_abwidth                        mean_RT_200_all  dual_average_accuracy
   5 Combined_abdepth                        mean_RT_200_all  dual_average_accuracy
   6 Combined_lag3vslag8_residuals           mean_RT_200_all  dual_average_accuracy
   7 Combined_lag3vslag8_stdrdized_residuals mean_RT_200_all  dual_average_accuracy
   8 Combined_t2|t1_lag8                     mean_RT_1000_all dual_average_accuracy
   9 Combined_abmag_t2_lag8_minus_lag3       mean_RT_1000_all dual_average_accuracy
  10 Combined_abmag_t2_1.0_minus_lag3        mean_RT_1000_all dual_average_accuracy
  # ... with 53 more rows
  </code></pre>
  <p>I need to read each line of this data frame into the following code to run an iterative Factor analysis on all combinations of the variables these names represent. I would like to pass each row of the data frame in &quot;quotes&quot; separated by comma so they can be ready by the <code>select</code> function.</p>
  <pre><code>Cog_data_test&lt;-
      Data_final%&gt;%
        select(&quot; Combined_t2|t1_lag8&quot;, &quot;mean_RT_1000_all&quot;, &quot;dual_average_accuracy&quot;)
    
    data_stand &lt;-data.frame(scale(Cog_data_test, center=TRUE, scale=TRUE))
    
    EFAResult = fa(data_stand, fm=&quot;pa&quot;, rotate = &quot;oblimin&quot;)
    
    
    EFAResult$loadings
  </code></pre>
  <p>the FA code works fine if I input the variable names individually, but as this is an issue of scale I have created the data frame of variables. Also, this needs some sort of <code>for</code> loop around it to read in each row of the data frame, select the columns with those names from the larger data set, and run the factor analysis. Really not sure how to do this!</p>