stringr 1.0.0
-
stringr is now powered by stringi instead of base R regular expressions. This improves unicode and support, and makes most operations considerably faster. If you find stringr inadequate for your string processing needs, I highly recommend looking at stringi in more detail.
-
stringr gains a vignette, currently a straight forward update of the article that appeared in the R Journal.
-
str_c()now returns a zero length vector if any of its inputs are zero length vectors. This is consistent with all other functions, and standard R recycling rules. Similarly, usingstr_c("x", NA)now yieldsNA. If you want"xNA", usestr_replace_na()on the inputs. -
str_replace_all()gains a convenient syntax for applying multiple pairs of pattern and replacement to the same vector:input <- c("abc", "def") str_replace_all(input, c("[ad]" = "!", "[cf]" = "?"))
-
str_match()now returns NA if an optional group doesn't match (previously it returned ""). This is more consistent withstr_extract()and other match failures. -
New
str_subset()keeps values that match a pattern. It's a convenient wrapper forx[str_detect(x)](#21, @jiho). -
New
str_order()andstr_sort()allow you to sort and order strings in a specified locale. -
New
str_conv()to convert strings from specified encoding to UTF-8. -
New modifier
boundary()allows you to count, locate and split by character, word, line and sentence boundaries. -
The documentation got a lot of love, and very similar functions (e.g. first and all variants) are now documented together. This should hopefully make it easier to locate the function you need.
-
ignore.case(x)has been deprecated in favour offixed|regexp|coll(x, ignore.case = TRUE),perl(x)has been deprecated in favour ofregexp(x). -
str_join()is deprecated, please usestr_c()instead.