tidyverse / stringr

A fresh approach to string manipulation in R

Home Page:https://stringr.tidyverse.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

minimum required vctrs version

bhogan-mitre opened this issue · comments

There may be a minimum required version of vctrs implied by the recent changes in stringr version 1.5.0.

# devtools::install_version("vctrs", version = "0.3.8")

library(stringr)

fruit <- c("apple", "banana", "pear", "pineapple")
str_detect(fruit, "a")

Produces:

> str_detect(fruit, "a")
Error in `stop_vctrs()`:
! Input must be a vector, not an environment.
Run `rlang::last_error()` to see where the error occurred.
> rlang::last_trace()
<error/vctrs_error_scalar_type>
Error in `stop_vctrs()`:
! Input must be a vector, not an environment.
---
Backtrace:
    ▆
 1. ├─stringr::str_detect(fruit, "a")
 2. │ └─stringr:::check_lengths(string, pattern)
 3. │   └─vctrs::vec_size_common(...)
 4. └─vctrs:::stop_scalar_type(`<fn>`(`<env>`), "")
 5.   └─vctrs:::stop_vctrs(msg, "vctrs_error_scalar_type", actual = x)
 6.     └─rlang::abort(message, class = c(class, "vctrs_error"), ...)
> sessionInfo()
R version 4.0.4 (2021-02-15)
Platform: x86_64-apple-darwin17.0 (64-bit)
Running under: macOS 12.6.1

Matrix products: default
LAPACK: /Library/Frameworks/R.framework/Versions/4.0/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

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

other attached packages:
[1] stringr_1.5.0

loaded via a namespace (and not attached):
 [1] rstudioapi_0.13   magrittr_2.0.3    usethis_2.1.3     devtools_2.4.2   
 [5] pkgload_1.2.3     R6_2.5.1          rlang_1.0.6       fastmap_1.1.0    
 [9] fansi_1.0.3       tools_4.0.4       pkgbuild_1.2.0    sessioninfo_1.2.1
[13] utf8_1.2.2        cli_3.4.0         withr_2.5.0       ellipsis_0.3.2   
[17] remotes_2.4.2     rprojroot_2.0.2   lifecycle_1.0.3   crayon_1.5.1     
[21] brio_1.1.2        processx_3.5.2    purrr_0.3.4       callr_3.7.0      
[25] vctrs_0.3.8       fs_1.5.2          ps_1.6.0          testthat_3.1.5   
[29] memoise_2.0.1     glue_1.6.2        cachem_1.0.6      stringi_1.7.6    
[33] pillar_1.7.0      compiler_4.0.4    desc_1.4.0        prettyunits_1.1.1

Want to do a PR? It'd be much appreciated.

It seems to work fine w/vctrs 0.4.0 where it was failing with 0.3.8 above. Opened PR to require at least 0.4.0 or later. Let me know if you need anything else here. Thanks.