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

str_c: Can't join vectors of different lengths anymore

mroosmalen opened this issue · comments

I used the str_c function in a script, which joins two vector of different lengths. For the simplicity I have made a simple example:

stringr::str_c(letters[1:4], "-", rep(1:4,each=4))

Which gave the following expected output with version 1.4.0

 [1] "a-1" "b-1" "c-1" "d-1" "a-2" "b-2" "c-2" "d-2" "a-3" "b-3" "c-3" "d-3" "a-4" "b-4"
[15] "c-4" "d-4"

When I run the same command with the newest version 1.5.0, it returns a error:

Error in `stringr::str_c()`:
! Can't recycle `..1` (size 4) to match `..3` (size 16).

I there something changed in the function, which you can't join vectors of different lengths?

Yes, this was a deliberate change as part of a cross tidyverse move to stricter recycling rules.