-
Notifications
You must be signed in to change notification settings - Fork 195
Closed
Description
With stringr 1.5.1, the str_sort function strips names from the vector.
Current behavior:
x <- c(A="3", B="2", C="1")
> str(x)
Named chr [1:3] "3" "2" "1"
- attr(*, "names")= chr [1:3] "A" "B" "C"
> stringr::str_sort(x)
[1] "1" "2" "3"
> str(stringr::str_sort(x))
chr [1:3] "1" Expected behavior:
x <- c(A="3", B="2", C="1")
> str(x)
Named chr [1:3] "3" "2" "1"
- attr(*, "names")= chr [1:3] "A" "B" "C"
> stringr::str_sort(x)
[1] "1" "2" "3"
> str(stringr::str_sort(x))
Named chr [1:3] "1" "2" "3"
- attr(*, "names")= chr [1:3] "C" "B" "A"> sessionInfo()
R version 4.4.1 (2024-06-14)
Platform: x86_64-apple-darwin20
Running under: macOS 15.0.1
Matrix products: default
BLAS: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/4.4-x86_64/Resources/lib/libRlapack.dylib; LAPACK version 3.12.0
locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
time zone: America/New_York
tzcode source: internal
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_2.4.5 usethis_2.2.3
loaded via a namespace (and not attached):
[1] vctrs_0.6.5 cli_3.6.2 rlang_1.1.4 stringi_1.8.4
[5] purrr_1.0.2 pkgload_1.3.4 renv_1.0.11 promises_1.3.0
[9] shiny_1.8.1.1 xtable_1.8-4 glue_1.7.0 htmltools_0.5.8.1
[13] httpuv_1.6.15 pkgbuild_1.4.4 ellipsis_0.3.2 fastmap_1.2.0
[17] lifecycle_1.0.4 memoise_2.0.1 stringr_1.5.1 compiler_4.4.1
[21] miniUI_0.1.1.1 sessioninfo_1.2.2 fs_1.6.4 htmlwidgets_1.6.4
[25] Rcpp_1.0.12 urlchecker_1.0.1 later_1.3.2 tcltk_4.4.1
[29] digest_0.6.36 R6_2.5.1 magrittr_2.0.3 tools_4.4.1
[33] mime_0.12 profvis_0.3.8 remotes_2.5.0 cachem_1.1.0Metadata
Metadata
Assignees
Labels
No labels