title: R-Error: data_frames can only contain 1d atomic vectors and lists
body: <p>I am trying to apply the dplyr package and calculate the number of entries for each card number in a dataset with the following function:</p>
  
  <pre><code>freq&lt;- function(data){
    data &lt;- complete.dupremoved[order(-complete.dupremoved$SUMMA),]
    aggregate(count ~., data=transform(complete.dupremoved,count=1), length)
    complete.dupremoved$count &lt;-complete.dupremoved[complete.dupremoved$KLIENDIKAARDINR,]
    sample &lt;- count(complete.dupremoved, vars = "KLIENDIKAARDINR")
    complete.dupremoved&lt;- merge(complete.dupremoved,sample, by ="KLIENDIKAARDINR")
    return(complete.dupremoved)
  }
  </code></pre>
  
  <p>The error shown is Error: data_frames can only contain 1d atomic vectors and lists.</p>
  
  <p>When I do the :
  lapply(complete.dupremoved,class)</p>
  
  <p>Some columns are numeric , factors , character , integer. Any solution how to solve this?
  Also the debugger gives the following:</p>
  
  <pre><code>function (x) 
  {
      stopifnot(is.list(x))
      if (length(x) == 0) {
          x &lt;- list()
          class(x) &lt;- c("tbl_df", "tbl", "data.frame")
          attr(x, "row.names") &lt;- .set_row_names(0)
          return(x)
      }
      names_x &lt;- names2(x)
      if (any(is.na(names_x) | names_x == "")) {
          stop("All columns must be named", call. = FALSE)
      }
      ok &lt;- vapply(x, is_1d, logical(1))
      **if (any(!ok)) {
          stop("data_frames can only contain 1d atomic vectors and lists", 
              call. = FALSE)**
      }
      n &lt;- unique(vapply(x, NROW, integer(1)))
      if (length(n) != 1) {
          stop("Columns are not all same length", call. = FALSE)
      }
      class(x) &lt;- c("tbl_df", "tbl", "data.frame")
      attr(x, "row.names") &lt;- .set_row_names(n)
      x
  }
  </code></pre>