title: Printing a column name inside lapply function
body: <p>I have searched through the archives but have not found a suitable answer. I am a beginner and please excuse my ignorance if I am posing a very elementary query. I am trying to get the apply function to print the column names while processing through a data frame. I understand that lapply converts the column of data frame to vector, but is their way to print the column name while printing output. Like in the following example</p>
  
  <pre><code>   &gt; mydata&lt;-data.frame(matrix(rep(c(1:2),times= 50),20,5))
     &gt; colnames(mydata)&lt;-letters[1:5]
     &gt; lapply(mydata[,2:4],function(x){CrossTable(x,mydata[,5])})
  </code></pre>
  
  <p>I want the output to show the column name it is processing while printing the output table. It only prints only "x"  right now in the contingency tables.</p>