stringr v0.5


Monthly downloads



by Hadley Wickham

Make it easier to work with strings.

stringr is a set of simple wrappers that make R's string functions more consistent, simpler and easier to use. It does this by ensuring that: function and argument names (and positions) are consistent, all functions deal with NA's and zero length character appropriately, and the output data structures from each function matches the input data structures of other functions.

Functions in stringr

Name Description
str_detect Detect the presence or absence of a pattern in a string.
str_locate_all Locate the position of all occurences of a pattern in a string.
str_sub_replace Replace substrings in a character vector.
str_sub Extract substrings from a character vector.
str_split Split up a string into a variable number of pieces.
str_match Extract first matched group from a string.
check_pattern Check that pattern is of the correct type for stringr functions...
str_match_all Extract all matched groups from a string.
str_wrap Wrap strings into nicely formatted paragraphs.
str_split_fixed Split up a string into a fixed number of pieces.
fixed Match fixed characters, not regular expression.
str_pad Pad a string.
str_locate Locate the position of the first occurence of a pattern in a string.
str_length The length of a string (in characters).
invert_match Switch location of matches to location of non-matches.
str_replace Replace first occurrence of a matched pattern in a string.
check_string Check that stringr is of the correct type for stringr functions...
str_dup Duplicate and concatenate strings within a character vector.
str_extract Extract first piece of a string that matches a pattern.
str_trim Trim whitespace from start and end of string. Ignore case of match.
str_count Count the number of matches in a string.
str_extract_all Extract all pieces of a string that match a pattern.
word Extract words from a sentence.
str_replace_all Replace all occurrences of a matched pattern in a string.
str_c Join multiple strings into a single string.
No Results!

Last month downloads


License GPL-2
Type Package
Collate 'c.r' 'checks.r' 'count.r' 'detect.r' 'dup.r' 'extract.r' 'length.r' 'locate.r' 'match.r' 'modifiers.r' 'pad-trim.r' 'replace.r' 'split.r' 'sub.r' 'vectorise.r' 'word.r' 'wrap.r'
Packaged 2011-06-30 15:35:34 UTC; hadley
Repository CRAN
Date/Publication 2011-06-30 17:12:32

Include our badge in your README