title: Store output of sapply into a data frame?
body: <p>how can I store the output of <code>sapply()</code> to a dataframe where the index value is stored in first column and its value in corresponding 2nd column. For illustration, I have shown only 2 elements here, but there are 110 columns in my data. "loan" is the data frame.</p>
  
  <pre><code>cols &lt;- sapply(loan,function(x) sum(is.na(x)))                                                          
  cols                                                                          
  id                                                                               
  0                                                                              
  member_id                                                                             
  7
  </code></pre>
  
  <p>I want output as:                                 </p>
  
  <pre><code>var         value                             
  id            0                                  
  member_id     7   
  </code></pre>
  
  <p>I know that sapply() returns a vector, but when I print the vector, values are printed along with its some "index" e.g., column name if applied on a data frame. So, now when I want to store it as a data frame with two columns where 1st column contains the index part and the second column contains the value, how can I do it?</p>