[R-pkgs] stringr: version 0.4
Hadley Wickham
hadley at rice.edu
Wed Aug 25 20:08:12 CEST 2010
Strings are not glamorous, high-profile components of R, but they do
play a big role in many data cleaning and preparations tasks. R
provides a solid set of string operations, but because they have grown
organically over time, they can be inconsistent and a little hard to
learn. Additionally, they lag behind the string operations in other
programming languages, so that some things that are easy to do in
languages like Ruby or Python are rather hard to do in R. The
`stringr` package aims to remedy these problems by providing a clean,
modern interface to common string operations.
More concretely, `stringr`:
* Processes factors and characters in the same way.
* Gives functions consistent names and arguments.
* Simplifies string operations by eliminating options that you don't need
95% of the time.
* Produces outputs than can easily be used as inputs. This includes ensuring
that missing inputs result in missing outputs, and zero length inputs
result in zero length outputs.
* Completes R's string handling functions with useful functions from other
programming languages.
New in stringr 0.4:
* all functions now vectorised with respect to string, pattern (and
where appropriate) replacement parameters
* fixed() function now tells stringr functions to use fixed matching, rather
than escaping the regular expression. Should improve performance for
large vectors.
* new ignore.case() modifier tells stringr functions to ignore case of
pattern.
* str_replace renamed to str_replace_all and new str_replace function added.
This makes str_replace consistent with all functions.
* new str_sub<- function (analogous to substring<-) for substring replacement
* str_sub now understands negative positions as a position from the end of
the string. -1 replaces Inf as indicator for string end.
* str_pad side argument can be left, right, or both (instead of center)
* str_trim gains side argument to better match str_pad
* stringr now has a namespace and imports plyr (rather than requiring it)
--
Assistant Professor / Dobelman Family Junior Chair
Department of Statistics / Rice University
http://had.co.nz/
More information about the R-packages
mailing list