New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior of str_trunc #203

Closed
guiastrennec opened this Issue Dec 29, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@guiastrennec

guiastrennec commented Dec 29, 2017

I encountered an unexpected behavior of str_trunc(), here is a reprex of my problem.

In stringr v1.2.0 the result is as expected:

str_trunc(c('abcd', 'abcde', 'abcdef'), width = 5)
[1] "abcd"  "abcde" "ab..."

In stringr v1.2.0.9000 the result not what one would unexpect:

str_trunc(c('abcd', 'abcde', 'abcdef'), width = 5)
[1] "abcd"   "abcde"  "abcdef"

And changing the order of the elements of the vector also impacts the output, which leads me to believe that the truncation is performed or not based on the number of characters in the first element of the vector of strings

str_trunc(c('abcdef', 'abcde', 'abcd'), width = 5)
[1] "ab..." "ab..." "ab..."

calpan added a commit to calpan/stringr that referenced this issue Apr 6, 2018

Fixes tidyverse#203.
Duplicate of pull request tidyverse#206, which was broken because TravisCI was using a different serialization format for R-devel checks. See http://r.789695.n4.nabble.com/R-CMD-build-then-check-fails-on-R-devel-due-to-serialization-version-td4747582.html for details.

@hadley hadley closed this in #206 May 8, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment