title: Error in rbind(deparse.level, ...) : invalid list argument: all variables should have the same length
body: <p>I am trying to use "rbind" to get the result but I am being shown an error 
  "Error in rbind(deparse.level, ...) : 
  invalid list argument: all variables should have the same length" </p>
  
  <pre><code>pm2 &lt;- function(directory, id=1:322)
  {
    files  &lt;- list.files(path = directory, full.names = TRUE)
    df &lt;- data.frame()
    for (i in 1:322)
    {
          fil &lt;- read.csv(files[i])
          df &lt;- rbind(df, fil)
    }
    df2 &lt;- data.frame(matrix(nrow = length(id), ncol = 2))
    colnames(df2) &lt;- c("id", "nobs")
    for(i in id){
  
          rbind(df2, c(df[[id[i]]],count((df[[id[i]]])),na.rm = TRUE)) 
  
    }
    df2
  }
  pm2("specdata", 1:10)
  </code></pre>