Learn R Programming

⚠️There's a newer version (1.5.1) of this package.Take me there.

stringr (version 0.6.2)

Make it easier to work with strings.

Description

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.

Copy Link

Version

Install

install.packages('stringr')

Monthly Downloads

1,296,877

Version

0.6.2

License

GPL-2

Maintainer

Last Published

December 6th, 2012

Functions in stringr (0.6.2)

str_length

The length of a string (in characters).
perl

Use perl regular expressions.
str_dup

Duplicate and concatenate strings within a character vector.
str_match

Extract first matched group from a string.
str_detect

Detect the presence or absence of a pattern in a string.
str_extract

Extract first piece of a string that matches a pattern.
str_replace

Replace first occurrence of a matched pattern in a string.
str_match_all

Extract all matched groups from a string.
str_sub_replace

Replace substrings in a character vector. str_sub<- will recycle all arguments to be the same length as the longest argument.
str_extract_all

Extract all pieces of a string that match a pattern.
str_replace_all

Replace all occurrences of a matched pattern in a string.
fixed

Match fixed characters, not regular expression.
str_sub

Extract substrings from a character vector.
str_locate_all

Locate the position of all occurences of a pattern in a string.
str_c

Join multiple strings into a single string.
ignore.case

Ignore case of match.
str_split_fixed

Split up a string into a fixed number of pieces.
str_split

Split up a string into a variable number of pieces.
str_count

Count the number of matches in a string.
str_pad

Pad a string.
str_locate

Locate the position of the first occurence of a pattern in a string.
str_trim

Trim whitespace from start and end of string.
invert_match

Switch location of matches to location of non-matches.
str_wrap

Wrap strings into nicely formatted paragraphs.
word

Extract words from a sentence.