tidymodels / infer

An R package for tidyverse-friendly statistical inference
https://infer.tidymodels.org
Other
726 stars 80 forks source link

rep_slice_sample unused argument error in vctrs:vec_chop #537

Closed robrill closed 7 months ago

robrill commented 7 months ago

Running a simple repeated sampling from mtcars:

library(dplyr)
library(infer)
data(mtcars)

slices <-  rep_slice_sample(mtcars, n = 50, reps = 1000)

#OR

slices <- rep_sample_n(mtcars, size=50, replace = TRUE, reps = 1000, prob = mtcars$wt)

return the following errors:


`Error in vctrs::vec_chop(seq_len(n * reps), sizes = rep(n, reps)): unused argument (sizes = rep(n, reps))`
`Error in vctrs::vec_chop(idx_list, sizes = rep(size, reps)) : 
  unused argument (sizes = rep(size, reps))
Error in vctrs::vec_chop(idx_list, sizes = rep(size, reps)): unused argument (sizes = rep(size, reps))
`

Here's session info:


sessionInfo()

R version 4.2.2 Patched (2022-11-10 r83330)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 22.04.4 LTS

Matrix products: default
BLAS:   /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/libopenblasp-r0.3.20.so

locale:
 [1] LC_CTYPE=C.UTF-8       LC_NUMERIC=C           LC_TIME=C.UTF-8       
 [4] LC_COLLATE=C.UTF-8     LC_MONETARY=C.UTF-8    LC_MESSAGES=C.UTF-8   
 [7] LC_PAPER=C.UTF-8       LC_NAME=C              LC_ADDRESS=C          
[10] LC_TELEPHONE=C         LC_MEASUREMENT=C.UTF-8 LC_IDENTIFICATION=C   

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] infer_1.0.7 dplyr_1.1.0

loaded via a namespace (and not attached):
 [1] fansi_1.0.4      utf8_1.2.3       SparkR_3.4.1     grid_4.2.2      
 [5] R6_2.5.1         gtable_0.3.1     lifecycle_1.0.3  magrittr_2.0.3  
 [9] scales_1.2.1     ggplot2_3.4.0    pillar_1.8.1     rlang_1.0.6     
[13] cli_3.6.0        vctrs_0.5.2      generics_0.1.3   tools_4.2.2     
[17] glue_1.6.2       purrr_1.0.1      munsell_0.5.0    compiler_4.2.2  
[21] colorspace_2.1-0 pkgconfig_2.0.3  Rserve_1.8-12    tidyselect_1.2.0
[25] tibble_3.1.8    

Did a little sleuthing but haven't been able to track down what's breaking it. A change to vctrs?

Thanks for all the hard work on a great package!

simonpcouch commented 7 months ago

Thanks for the issue! Did you intend to close this issue as completed?

simonpcouch commented 7 months ago

Looks like my vctrs version is quite a bit newer than yours, so maybe we have an unstated dependency on a relatively new vctrs argument.

robrill commented 7 months ago

Ha, yep--realized right after I wrote it up that vec_chop in vctrs 0.5.2 didn't take sizes as an argument yet. Updated it and solved the problem. Thanks for checking!

github-actions[bot] commented 7 months ago

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex: https://reprex.tidyverse.org) and link to this issue.