title: print column names from a data frame using for loop
body: <p>I have two data frames (say frame1 and frame2). Each has a large number of variables (say frame1 has variables a1, a2, a3…and frame 2 has variables b1, b2, b3….). I am doing chi square test of independence between all possible pairs of variables from the two frames (so between a1 and b1; a1 and b2; a1 and b3,….etc.). I am using the following for loop to do this which works out perfectly EXCEPT in the output all I get is the results without specifying which analysis belongs to which sets of variables. I would like to have the results in a way so that each INDIVIDUAL analysis is preceded by the two variable names that the analysis was for.</p>
  
  <pre><code>for (i in frame1) {
  for (j in frame2) 
  print({chisq.test(table(i,j))})}
  </code></pre>
  
  <p>R is pretty new to me so any help would be appreciated!!</p>