title: Converting output of lapply into a data frame
body: <p>I'm aware there are many posts on this already. I promise that I have looked at them. Nevertheless I'm struggling.</p>
  
  <p>Below is a dput list which is the output of a call to lapply.</p>
  
  <p>I wouldlike a nice, easy to read data frame with 2 columns, one for true and one for false, with a row for each of the 25 list items.</p>
  
  <p>Tried:</p>
  
  <pre><code> falsies &lt;- lapply(my_list, function(x) table(tolower(x) %in% c("", "unknown", "\\?"))) %&gt;% 
  +   data.frame(do.call(rbind, .))
  </code></pre>
  
  <blockquote>
    <p>Error in data.frame(., do.call(rbind, .)) : 
    arguments imply differing number of rows: 2, 25</p>
  </blockquote>
  
  <pre><code>falsies &lt;- lapply(my_list, function(x) table(tolower(x) %in% c("", "unknown", "\\?"))) %&gt;% 
    as.data.frame.matrix()
  </code></pre>
  
  <blockquote>
    <p>Error in seq_len(ncols) : 
      argument must be coercible to non-negative integer
    In addition: Warning message:
    In seq_len(ncols) : first element used of 'length.out' argument</p>
  </blockquote>
  
  <pre><code>falsies &lt;- lapply(my_list, function(x) table(tolower(x) %in% c("", "unknown", "\\?"))) %&gt;% as.vector(t(.)) %&gt;% 
    as.data.frame(Field = names(.), Value = unlist(.))
  </code></pre>
  
  <blockquote>
    <p>Error in as.vector(x, mode) : invalid 'mode' argument</p>
  </blockquote>
  
  <p>How can I convert my list into a 2 feature wide data frame?</p>
  
  <pre><code>my_list &lt;- structure(list(ID = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), Fiscal_Week_Date = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), FISCAL_WEEK = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), SU_CURRENT_RECORD_IND = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), PROFIT_CENTRE = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), ACTIVE_ON_BASE = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), SU_STATUS_ID = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), SU_BIRTH_DATE = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), SU_GENDER = structure(c(17193L, 
  13899L), .Dim = 2L, .Dimnames = structure(list(c("FALSE", "TRUE"
  )), .Names = ""), class = "table"), AVERAGE_SPEND = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), CU_PAPERLESS_BILL_IND = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), SU_FIXED_MOBILE_IND = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), MMS_INDICATOR = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), INSURANCE_INDICATOR = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), INSURANCE_AMOUNT = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), PREFERRED_TOPUP_METHOD_DESC = structure(c(7672L, 
  23420L), .Dim = 2L, .Dimnames = structure(list(c("FALSE", "TRUE"
  )), .Names = ""), class = "table"), BROADBAND_IND = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), ICT_IND = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), TENURE_IN_MONTHS = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), CONTRACT_TYPE = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), HA_DEVICE_CAPABILITY = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), Year = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), Week = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), Age = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table"), Target_New_Card = structure(31092L, .Dim = 1L, .Dimnames = structure(list(
      "FALSE"), .Names = ""), class = "table")), .Names = c("ID", 
  "Fiscal_Week_Date", "FISCAL_WEEK", "SU_CURRENT_RECORD_IND", "PROFIT_CENTRE", 
  "ACTIVE_ON_BASE", "SU_STATUS_ID", "SU_BIRTH_DATE", "SU_GENDER", 
  "AVERAGE_SPEND", "CU_PAPERLESS_BILL_IND", "SU_FIXED_MOBILE_IND", 
  "MMS_INDICATOR", "INSURANCE_INDICATOR", "INSURANCE_AMOUNT", "PREFERRED_TOPUP_METHOD_DESC", 
  "BROADBAND_IND", "ICT_IND", "TENURE_IN_MONTHS", "CONTRACT_TYPE", 
  "HA_DEVICE_CAPABILITY", "Year", "Week", "Age", "Target_New_Card"
  ))
  </code></pre>