title: 'list' object cannot be coerced to type 'integer' -- WRS2 package
body: <p>I come across the below error when trying to use a function of WRS2 package.</p>
  <blockquote>
  <p>Error in sequence.default(piece, ...) :
  'list' object cannot be coerced to type 'integer'</p>
  </blockquote>
  <p>Below is the code. Percentile_rank, grade_level, and books_quantile's data types are numeric data. Percentile rank's value is from 1-99, grade_level from 1-10, and books_quantile from 1-3. And each observation reflects one student's grade, their test score's percentile rank, and the quartile of number of books they received.</p>
  <pre><code>library(WRS2)
  pbad2way(percentile_rank~ grade_level + books_quantile + grade_level*books_quantile,
           data = read) 
  
  </code></pre>
  <p>A snapshot of data frame &quot;read&quot; is as below (I removed some variables that are sensitive/not relevant)</p>
  <pre><code>tibble [20,903 x 21] (S3: tbl_df/tbl/data.frame)
   $ id                    : chr [1:20903] &quot;4886656&quot; &quot;4648093&quot; &quot;4544642&quot; &quot;4487743&quot; ...
   $ school_year_key          : chr [1:20903] &quot;2019&quot; &quot;2019&quot; &quot;2019&quot; &quot;2019&quot; ...
   $ grade_key                : chr [1:20903] &quot;736&quot; &quot;738&quot; &quot;738&quot; &quot;738&quot; ...
   $ grade_level              : Factor w/ 10 levels &quot;1&quot;,&quot;2&quot;,&quot;3&quot;,&quot;4&quot;,..: 1 3 3 3 3 3 3 3 3 4 ...
   $ percentile_rank          : num [1:20903] 43 97 84 23 27 5 84 6 1 21 ...
   $ books_count              : num [1:20903] 55 46 43 56 57 55 49 42 51 57 ...
   $ discipline               : chr [1:20903] &quot;Reading&quot; &quot;Reading&quot; &quot;Reading&quot; &quot;Reading&quot; ...
   $ books_quantile           : Factor w/ 3 levels &quot;1&quot;,&quot;2&quot;,&quot;3&quot;: 2 2 2 3 3 2 2 2 2 3 ...
  
  </code></pre>
  <p>When I used traceback() after the error, it says below:</p>
  <pre><code>8: sequence.default(piece, ...)
  7: .fun(piece, ...)
  6: (function (i) 
     {
         piece &lt;- pieces[[i]]
         if (.inform) {
             res &lt;- try(.fun(piece, ...))
             if (inherits(res, &quot;try-error&quot;)) {
                 piece &lt;- paste(utils::capture.output(print(piece)), 
                     collapse = &quot;\n&quot;)
                 stop(&quot;with piece &quot;, i, &quot;: \n&quot;, piece, call. = FALSE)
             }
         }
         else {
             res &lt;- .fun(piece, ...)
         }
         progress$step()
         res
     })(10L)
  5: loop_apply(n, do.ply)
  4: llply(.data = pieces, .fun = .fun, ..., .progress = .progress, 
         .inform = .inform, .parallel = .parallel, .paropts = .paropts)
  3: alply(nfac1, 1, sequence)
  2: unlist(alply(nfac1, 1, sequence), use.names = FALSE)
  1: pbad2way(percentile_rank ~ grade_level + books_quantile + grade_level * 
         books_quantile, data = read)
  
  </code></pre>