diff --git a/docs/LICENSE-text.html b/docs/LICENSE-text.html new file mode 100644 index 00000000..ce211a03 --- /dev/null +++ b/docs/LICENSE-text.html @@ -0,0 +1,477 @@ + + + + + + + + +License • stringr + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + + +
+ +
+
+ + +
                    GNU GENERAL PUBLIC LICENSE
+                       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Lesser General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+                    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                            NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+            How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License along
+    with this program; if not, write to the Free Software Foundation, Inc.,
+    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Lesser General
+Public License instead of this License.
+
+ +
+ +
+ + + +
+ + + + + + diff --git a/docs/articles/index.html b/docs/articles/index.html index d1da5fed..a4b74fc9 100644 --- a/docs/articles/index.html +++ b/docs/articles/index.html @@ -33,7 +33,7 @@ -
+
- -
-
+
+ +

All vignettes

@@ -124,21 +124,23 @@

All vignettes

-

Developed by Hadley Wickham, .

+

Developed by Hadley Wickham, RStudio.

Site built by pkgdown.

+
+ + + diff --git a/docs/articles/regular-expressions.html b/docs/articles/regular-expressions.html index 3d3fad82..646677e2 100644 --- a/docs/articles/regular-expressions.html +++ b/docs/articles/regular-expressions.html @@ -15,7 +15,7 @@ -
+
-
+
+ + Source: vignettes/regular-expressions.Rmd + + +
-

Regular expressions are a concise and flexible tool for describing patterns in strings. This vignette describes the key features of stringr’s regular expressions, as implemented by stringi. It is not a tutorial, so if you’re unfamiliar regular expressions, I’d recommend starting at http://r4ds.had.co.nz/strings.html. If you want to master the details, I’d recommend reading the classic Mastering Regular Expressions by Jeffrey E. F. Fried.

Regular expressions are the default pattern engine in stringr. That means when you use a pattern matching function with a bare string, it’s equivalent to wrapping it in a call to regex():

# The regular call:
@@ -96,7 +99,9 @@ 

Regular expressions

# Is shorthand for str_extract(fruit, regex("nana"))

You will need to use regex() explicitly if you want to override the default options, as you’ll see in examples below.

-

Basic matches

+
+

+Basic matches

The simplest patterns match exact strings:

x <- c("apple", "banana", "pear")
 str_extract(x, "an")
@@ -115,7 +120,10 @@ 

Regular expressions

#> [1] FALSE str_detect("\nX\n", regex(".X.", dotall = TRUE)) #> [1] TRUE
-

Escaping

+
+
+

+Escaping

If “.” matches any character, how do you match a literal “.”? You need to use an “escape” to tell the regular expression you want to match it exactly, not use its special behaviour. Like strings, regexps use the backslash, \, to escape special behaviour. So to match an ., you need the regexp \.. Unfortunately this creates a problem. We use strings to represent regular expressions, and \ is also used as an escape symbol in strings. So to create the regular expression \. we need the string "\\.".

# To create the regular expression, we need \\
 dot <- "\\."
@@ -143,7 +151,10 @@ 

Regular expressions

#> [1] TRUE TRUE str_detect(x, paste0("^\\Q", starts_with, "\\E")) #> [1] TRUE FALSE
-

Special characters

+
+
+

+Special characters

Escapes also allow you to specify individual characters that are otherwise hard to type. You can specify individual unicode characters in five ways, either as a variable number of hex digits (four is most common), or by name:

  • \xhh: 2 hex digits.

  • @@ -164,7 +175,10 @@

    Regular expressions

  • \0ooo match an octal character. ‘ooo’ is from one to three octal digits, from 000 to 0377. The leading zero is required.

(Many of these are only of historical interest and are only included here for the sake of completeness.)

-

Matching multiple characters

+
+
+

+Matching multiple characters

There are a number of patterns that match more than one character. You’ve already seen ., which matches any character (except a newline). A closely related operator is \X, which matches a grapheme cluster, a set of individual elements that form a single symbol. For example, one way of representing “á” is as the letter “a” plus an accent: . will match the component “a”, while \X will match the complete symbol:

x <- "a\u0301"
 str_extract(x, ".")
@@ -221,7 +235,7 @@ 

Regular expressions

  • [^abc]: matches anything except a, b, or c.
  • -[\^\-]: matches - or \.
  • +[\^\-]: matches ^ or -.

    There are a number of pre-built classes that you can use inside []:

      @@ -252,12 +266,18 @@

      Regular expressions

    These all go inside the [] for character classes, i.e. [[:digit:]AX] matches all digits, A, and X.

    You can also using Unicode properties, like [\p{Letter}], and various set operations, like [\p{Letter}--\p{script=latin}]. See ?"stringi-search-charclass" for details.

    -

    Alternation

    +
    +
    +

    +Alternation

    | is the alternation operator, which will pick between one or more possible matches. For example, abc|def will match abc or def.

    str_detect(c("abc", "def", "ghi"), "abc|def")
     #> [1]  TRUE  TRUE FALSE

    Note that the precedence for | is low, so that abc|def matches abc or def not abcyz or abxyz.

    -

    Grouping

    +
    +
    +

    +Grouping

    You can use parentheses to override the default precedence rules:

    str_extract(c("grey", "gray"), "gre|ay")
     #> [1] "gre" "ay"
    @@ -290,7 +310,10 @@ 

    Regular expressions

    #> [1,] "grey" #> [2,] "gray"

    This is most useful for more complex cases where you need to capture matches and control precedence independently.

    -

    Anchors

    +
    +
    +

    +Anchors

    By default, regular expressions will match any part of a string. It’s often useful to anchor the regular expression so that it matches from the start or end of the string:

    -

    Repetition

    +
    +
    +

    +Repetition

    You can control how many times a pattern matches with the repetition operators:

    The atomic match fails because it matches A, and then the next character is a C so it fails. The regular match succeeds because it matches A, but then C doesn’t match, so it back-tracks and tries B instead.

    -

    Look arounds

    +
    +
    +

    +Look arounds

    These assertions look ahead or behind the current match without “consuming” any characters (i.e. changing the input position).

    -

    Comments

    +
    +
    +

    +Comments

    There are two ways to include comments in a regular expression. The first is with (?#...):

    str_detect("xyz", "x(?#this is a comment)")
     #> [1] TRUE
    @@ -425,7 +457,6 @@

    Regular expressions

    str_match("514-791-8141", phone) #> [,1] [,2] [,3] [,4] #> [1,] "514-791-814" "514" "791" "814"
    -
    @@ -456,20 +487,20 @@

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    -
    + + diff --git a/docs/articles/releases/stringr-1.0.0.html b/docs/articles/releases/stringr-1.0.0.html index cafc5975..51a9bc84 100644 --- a/docs/articles/releases/stringr-1.0.0.html +++ b/docs/articles/releases/stringr-1.0.0.html @@ -15,7 +15,7 @@ -
    +
    -
    +
    + + Source: vignettes/releases/stringr-1.0.0.Rmd + + +
    -

    I’m very excited to announce the 1.0.0 release of the stringr package. If you haven’t heard of stringr before, it makes string manipulation easier by:

    • Using consistent function and argument names: all functions start with str_, and the first argument is always the input string This makes stringr easier to learn and easy to use with the pipe.

    • Eliminating options that you don’t need 95% of the time.

    To get started with stringr, check out the new vignette.

    -

    What’s new?

    +
    +

    +What’s new?

    The biggest change in this release is that stringr is now powered by the stringi package instead of base R. This has two big benefits: stringr is now much faster, and has much better unicode support.

    If you’ve used stringi before, you might wonder why stringr is still necessary: stringi does everything that stringr does, and much much more. There are two reasons that I think stringr is still important:

    -
      +
      1. Lots of people use it already, so this update will give many people a performance boost for free.

      2. The smaller API of stringr makes it a little easier to learn.

      That said, once you’ve learned stringr, using stringi should be easy, so it’s a great place to start if you need a tool that doesn’t exist in stringr.

      -

    New features and functions

    +
    +
    +

    +New features and functions

    • str_replace_all() gains a convenient syntax for applying multiple pairs of pattern and replacement to the same vector:

      @@ -138,7 +146,7 @@

      2015-05-05

      • 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, using str_c("x", NA) now yields NA. If you want "xNA", use str_replace_na() on the inputs.

      • str_match() now returns NA if an optional group doesn’t match (previously it returned “”). This is more consistent with str_extract() and other match failures.

      • -
      +
    @@ -161,20 +169,20 @@

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    -
    + + diff --git a/docs/articles/releases/stringr-1.1.0.html b/docs/articles/releases/stringr-1.1.0.html index e399679e..6e45890a 100644 --- a/docs/articles/releases/stringr-1.1.0.html +++ b/docs/articles/releases/stringr-1.1.0.html @@ -15,7 +15,7 @@ -
    +
    -
    +
    + + Source: vignettes/releases/stringr-1.1.0.Rmd + + +
    -

    This release is mostly bug fixes, but there are a couple of new features you might care out.

    • @@ -114,7 +117,6 @@

      2016-08-24

    • str_view() and str_view_all() create HTML widgets that display regular expression matches. This is particularly useful for teaching.

    -
    @@ -127,20 +129,20 @@

    2016-08-24

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    -
    + + diff --git a/docs/articles/releases/stringr-1.2.0.html b/docs/articles/releases/stringr-1.2.0.html index 20aade2b..958ca907 100644 --- a/docs/articles/releases/stringr-1.2.0.html +++ b/docs/articles/releases/stringr-1.2.0.html @@ -15,7 +15,7 @@ -
    +
    -
    +
    + + Source: vignettes/releases/stringr-1.2.0.Rmd + + +
    -
    -

    API changes

    +
    +

    +API changes

    This release includes a change to the API: str_match_all() now returns NA if an optional group doesn’t match (previously it returned “”). This is more consistent with str_match() and other match failures.

    -

    New features

    -

    There are three new featuers:

    +
    +
    +

    +New features

    +

    There are three new features:

  • A new vignette (vignette("regular-expressions")) describes the details of the regular expressions supported by stringr. The main vignette (vignette("stringr")) has been updated to give a high-level overview of the package.

  • -

    Minor improvements and bug fixes

    + +
    +
    +

    +Minor improvements and bug fixes

    There were three other minor improvements and bug fixes:

    • str_order() and str_sort() gain explicit numeric argument for sorting mixed numbers and strings.

    • str_replace_all() now throws an error if replacement is not a character vector. If replacement is NA_character_ it replaces the complete string with NA.

    • All functions that take a locale (e.g. str_to_lower() and str_sort()) default to “en” (English) to ensure that the default is consistent across platforms.

    • -
    +
    @@ -168,20 +180,20 @@

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    -
    + + diff --git a/docs/articles/stringr.html b/docs/articles/stringr.html index cdbcd95d..6fc838d9 100644 --- a/docs/articles/stringr.html +++ b/docs/articles/stringr.html @@ -15,7 +15,7 @@ -
    +
    -
    +
    + + Source: vignettes/stringr.Rmd + + +
    -

    There are four main families of functions in stringr:

    -
      +
      1. Character manipulation: these functions allow you to manipulate individual characters within the strings in character vectors.

      2. Whitespace tools to add, remove, and manipulate whitespace.

      3. Locale sensitive operations whose operations will vary from locale to locale.

      4. Pattern matching functions. These recognise four engines of pattern description. The most common is regular expressions, but there are three other tools.

      -

      Getting and setting individual characters

      +
      +

      +Getting and setting individual characters

      You can get the length of the string with str_length():

      @@ -118,9 +123,12 @@

      Introduction to stringr

      To duplicate individual strings, you can use str_dup():

      -

      Whitespace

      +
    +
    +

    +Whitespace

    Three functions add, remove, or modify whitespace:

    -
      +
      1. str_pad() pads a string to a fixed length by adding extra whitespace on the left, right, or both sides.

        x <- c("abc", "defghi")
        @@ -138,7 +146,7 @@ 

        Introduction to stringr

        x %>% str_trunc(10) %>% str_pad(10, "right") -#> [1] "Short " "This is a long string"
        +#> [1] "Short " "This is..."
  • The opposite of str_pad() is str_trim(), which removes leading and trailing whitespace:

    @@ -162,7 +170,11 @@

    Introduction to stringr

    #> were the borogoves, and the mome raths #> outgrabe.
  • -

    Locale sensitive

    + +
    +
    +

    +Locale sensitive

    A handful of stringr functions are locale-sensitive: they will perform differently in different regions of the world. These functions are case transformation functions:

    x <- "I like horses."
     str_to_upper(x)
    @@ -186,9 +198,14 @@ 

    Introduction to stringr

    str_sort(x, locale = "lt") #> [1] "i" "y" "k"

    The locale always defaults to English to ensure that the default behaviour is identical across systems. Locales always include a two letter ISO-639-1 language code (like “en” for English or “zh” for Chinese), and optionally a ISO-3166 country code (like “en_UK” vs “en_US”). You can see a complete list of available locales by running stringi::stri_locale_list().

    -

    Pattern matching

    +
    +
    +

    +Pattern matching

    The vast majority of stringr functions work with patterns. These are parameterised by the task they perform and the types of patterns they match.

    -

    Tasks

    +
    +

    +Tasks

    Each pattern matching function has the same first two arguments, a character vector of strings to process and a single pattern to match. stringr provides pattern matching functions to detect, locate, extract, match, replace, and split strings. I’ll illustrate how they work with some strings and a regular expression designed to match (US) phone numbers:

    strings <- c(
       "apple", 
    @@ -312,7 +329,11 @@ 

    Introduction to stringr

    #> [,1] [,2] #> [1,] "a" "b-c"
    -

    Engines

    + +
    +
    +

    +Engines

    There are four main engines that stringr can use to describe patterns:

    -

    Fixed matches

    +
    +

    +Fixed matches

    fixed(x) only matches the exact sequence of bytes specified by x. This is a very limited “pattern”, but the restriction can make matching much faster. Beware using fixed() with non-English data. It is problematic because there are often multiple ways of representing the same character. For example, there are two ways to define “á”: either as a single character or as an “a” plus an accent:

    a1 <- "\u00e1"
     a2 <- "a\u0301"
    @@ -333,7 +356,10 @@ 

    Introduction to stringr

    #> [1] FALSE str_detect(a1, coll(a2)) #> [1] TRUE
    -
    + +
    +

    +Boundary

    boundary() matches boundaries between characters, lines, sentences or words. It’s most useful with str_split(), but can be used with all pattern matching functions:

    x <- "This is a sentence."
     str_split(x, boundary("word"))
    @@ -362,7 +391,8 @@ 

    Introduction to stringr

    #> [18] "e" "." str_count(x, "") #> [1] 19
    - +
    +
    @@ -387,20 +417,20 @@

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    -
    + + diff --git a/docs/authors.html b/docs/authors.html index 67836f16..963db928 100644 --- a/docs/authors.html +++ b/docs/authors.html @@ -97,19 +97,19 @@ -
    -
    +
    +
    • -

      Hadley Wickham. Author, maintainer, copyright holder. +

      Hadley Wickham. Author, maintainer, copyright holder.

    • -

      . Copyright holder, funder. +

      RStudio. Copyright holder, funder.

    @@ -125,21 +125,23 @@

    Authors

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/favicon.ico b/docs/favicon.ico index a23c12b8..019450f2 100644 Binary files a/docs/favicon.ico and b/docs/favicon.ico differ diff --git a/docs/index.html b/docs/index.html index ede3f417..2493c2ce 100644 --- a/docs/index.html +++ b/docs/index.html @@ -15,7 +15,7 @@ -
    +
    -
    +
    -
    -
    +
    -

    Overview

    + +
    +

    +Overview

    Strings are not glamorous, high-profile components of R, but they do play a big role in many data cleaning and preparation tasks. The stringr package provide a cohesive set of functions designed to make working with strings as easy as possible. If you’re not familiar with strings, the best place to start is the chapter on strings in R for Data Science.

    stringr is built on top of stringi, which uses the ICU C library to provide fast, correct implementations of common string manipulations. stringr focusses on the most important and commonly used string manipulation functions whereas stringi provides a comprehensive set covering almost anything you can imagine. If you find that stringr is missing a function that you need, try looking in stringi. Both packages share similar conventions, so once you’ve mastered stringr, you should find stringi similarly easy to use.

    -

    Installation

    +
    +

    Usage

    +
    +
    +

    +Cheatsheet

    +

    +
    +
    +

    +Usage

    All functions in stringr start with str_ and take a vector of strings as the first argument.

    x <- c("why", "video", "cross", "extra", "deal", "authority")
     str_length(x) 
    @@ -182,7 +195,11 @@
     coll(): match human letters
     
  • boundary(): match boundaries
  • -

    Compared to base R

    + +
    +
    +

    +Compared to base R

    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.

    • @@ -195,15 +212,16 @@
    • 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.

    • -
    + +
    @@ -238,20 +269,20 @@

    Dev status

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    -
    + + diff --git a/docs/news/index.html b/docs/news/index.html index 7bc6af4c..1e5bedc2 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -6,7 +6,7 @@ -All news • stringr +Changelog • stringr @@ -97,86 +97,106 @@ -
    - -
    +
    +
    -
    -
    -

    stringr 1.3.0.9000

    +
    +

    +stringr 1.3.1 Unreleased +

    +
      +
    • str_replace_all() with a named vector now respects modifier functions (#207)

    • +
    • str_trunc() is once again vectorised correctly (#203, @austin3dickey).

    • +
    • str_view() handles NA values more gracefully (#217). I’ve also tweaked the sizing policy so hopefully it should work better in notebooks, while preserving the existing behaviour in knit documents (#232).

    • +
    -
    -

    stringr 1.3.0

    -
    -

    API changes

    +
    +

    +stringr 1.3.0 2018-02-19 +

    +
    +

    +API changes

    • During package build, you may see Error : object ‘ignore.case’ is not exported by 'namespace:stringr'. This is because the long deprecated str_join(), ignore.case() and perl() have now been removed.
    -
    -

    New features

    +
    +

    +New features

    -
    -

    Bug fixes and minor improvements

    +
    +

    +Bug fixes and minor improvements

    -
    -

    stringr 1.2.0

    -
    -

    API changes

    +
    +

    +stringr 1.2.0 2017-02-18 +

    +
    +

    +API changes

    • -str_match_all() now returns NA if an optional group doesn’t match (previously it returned “”). This is more consistent with str_match() and other match failures (#134).
    • +str_match_all() now returns NA if an optional group doesn’t match (previously it returned “”). This is more consistent with str_match() and other match failures (#134).
    -
    -

    New features

    +
    +

    +New features

    -
    -

    Minor improvements and bug fixes

    +
    +

    +Minor improvements and bug fixes

    • str_order() and str_sort() gain explicit numeric argument for sorting mixed numbers and strings.

    • -
    • str_replace_all() now throws an error if replacement is not a character vector. If replacement is NA_character_ it replaces the complete string with replaces with NA (#124).

    • +
    • str_replace_all() now throws an error if replacement is not a character vector. If replacement is NA_character_ it replaces the complete string with replaces with NA (#124).

    • All functions that take a locale (e.g. str_to_lower() and str_sort()) default to “en” (English) to ensure that the default is consistent across platforms.

    -
    -

    stringr 1.1.0

    +
    +

    +stringr 1.1.0 2016-08-19 +

    -
    -

    stringr 1.0.0

    +
    +

    +stringr 1.0.0 2015-04-30 +

    • 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.

    • @@ -187,7 +207,7 @@

      stringr 1.0.0

      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 with str_extract() and other match failures.

  • -
  • New str_subset() keeps values that match a pattern. It’s a convenient wrapper for x[str_detect(x)] (#21, @jiho).

  • +
  • New str_subset() keeps values that match a pattern. It’s a convenient wrapper for x[str_detect(x)] (#21, @jiho).

  • New str_order() and str_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.

  • @@ -196,29 +216,37 @@

    stringr 1.0.0

  • str_join() is deprecated, please use str_c() instead.

  • -
    -

    stringr 0.6.2

    +
    +

    +stringr 0.6.2 2012-12-06 +

    • fixed path in str_wrap example so works for more R installations.

    • remove dependency on plyr

    -
    -

    stringr 0.6.1

    +
    +

    +stringr 0.6.1 2012-07-25 +

    • Zero input to str_split_fixed returns 0 row matrix with n columns

    • Export str_join

    -
    -

    stringr 0.6

    +
    +

    +stringr 0.6 2011-12-08 +

    • new modifier perl that switches to Perl regular expressions

    • str_match now uses new base function regmatches to extract matches - this should hopefully be faster than my previous pure R algorithm

    -
    -

    stringr 0.5

    +
    +

    +stringr 0.5 2011-06-30 +

    • new str_wrap function which gives strwrap output in a more convenient format

    • new word function extract words from a string given user defined separator (thanks to suggestion by David Cooper)

    • @@ -229,8 +257,10 @@

      stringr 0.5

    • fix small bug in internal recyclable function

    -
    -

    stringr 0.4

    +
    +

    +stringr 0.4 2010-08-24 +

    • 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.
    • @@ -243,8 +273,10 @@

      stringr 0.4

    • stringr now has a namespace and imports plyr (rather than requiring it)
    -
    -

    stringr 0.3

    +
    +

    +stringr 0.3 2010-02-15 +

    • fixed() now also escapes |
    • str_join() renamed to str_c()
    • @@ -253,8 +285,10 @@

      stringr 0.3

    • add fixed() function to allow matching of fixed strings.
    -
    -

    stringr 0.2

    +
    +

    +stringr 0.2 2009-11-16 +

    • str_length now returns correct results when used with factors
    • str_sub now correctly replaces Inf in end argument with length of string
    • @@ -262,25 +296,24 @@

      stringr 0.2

    • str_split no longer uses strsplit to preserve trailing breaks
    -
    @@ -293,21 +326,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/pkgdown.css b/docs/pkgdown.css index e25861cd..d1dc62d8 100644 --- a/docs/pkgdown.css +++ b/docs/pkgdown.css @@ -234,3 +234,10 @@ a.anchor { background-color: transparent; text-decoration: underline; } + +/* orcid ------------------------------------ */ + +.orcid { + height: 16px; + vertical-align: middle; +} diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml new file mode 100644 index 00000000..e8d0b9f9 --- /dev/null +++ b/docs/pkgdown.yml @@ -0,0 +1,10 @@ +pandoc: 2.1.3 +pkgdown: 1.0.0 +pkgdown_sha: ~ +articles: + regular-expressions: regular-expressions.html + stringr-1.0.0: releases/stringr-1.0.0.html + stringr-1.1.0: releases/stringr-1.1.0.html + stringr-1.2.0: releases/stringr-1.2.0.html + stringr: stringr.html + diff --git a/docs/reference/case.html b/docs/reference/case.html index f8a1a12b..c1dc8c48 100644 --- a/docs/reference/case.html +++ b/docs/reference/case.html @@ -97,15 +97,19 @@ -
    +
    +

    Convert case of a string.

    +
    str_to_upper(string, locale = "en")
     
    @@ -113,7 +117,7 @@ 

    Convert case of a string.

    str_to_title(string, locale = "en")
    -

    Arguments

    +

    Arguments

    @@ -151,21 +155,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/index.html b/docs/reference/index.html index d76cf273..b5b88ebe 100644 --- a/docs/reference/index.html +++ b/docs/reference/index.html @@ -97,222 +97,217 @@ -
    -
    +
    +
    -
    -
    +
    - - - - + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Pattern matching

    -

    -
    -

    str_count

    -

    Count the number of matches in a string.

    -

    str_detect

    -

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

    -

    str_extract str_extract_all

    -

    Extract matching patterns from a string.

    -

    str_locate str_locate_all

    -

    Locate the position of patterns in a string.

    -

    str_match str_match_all

    -

    Extract matched groups from a string.

    -

    str_replace str_replace_all

    -

    Replace matched patterns in a string.

    -

    str_split str_split_fixed

    -

    Split up a string into pieces.

    -

    str_subset str_which

    -

    Keep strings matching a pattern, or find positions.

    -

    str_view str_view_all

    -

    View HTML rendering of regular expression match.

    -

    fixed coll regex boundary

    -

    Control matching behaviour with modifier functions.

    -

    Whitespace

    -

    -
    -

    str_pad

    -

    Pad a string.

    -

    str_trim str_squish

    -

    Trim whitespace from a string

    -

    str_wrap

    -

    Wrap strings into nicely formatted paragraphs.

    -

    Locale senstive

    -

    -
    -

    str_order str_sort

    -

    Order or sort a character vector.

    -

    str_to_upper str_to_lower str_to_title

    -

    Convert case of a string.

    -

    Other helpers

    -

    -
    -

    invert_match

    -

    Switch location of matches to location of non-matches.

    -

    str_c

    -

    Join multiple strings into a single string.

    -

    str_conv

    -

    Specify the encoding of a string.

    -

    str_dup

    -

    Duplicate and concatenate strings within a character vector.

    -

    str_glue str_glue_data

    -

    Format and interpolate a string with glue

    -

    str_length

    -

    The length of a string.

    -

    str_replace_na

    -

    Turn NA into "NA"

    -

    str_trunc

    -

    Truncate a character string.

    -

    str_sub str_sub<-

    -

    Extract and replace substrings from a character vector.

    -

    word

    -

    Extract words from a sentence.

    -

    Bundled data

    -

    -
    -

    sentences fruit words

    -

    Sample character vectors for practicing string manipulations.

    -
    + + + +

    Pattern matching

    +

    + + + + + +

    str_count()

    + +

    Count the number of matches in a string.

    + + + +

    str_detect()

    + +

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

    + + + +

    str_extract() str_extract_all()

    + +

    Extract matching patterns from a string.

    + + + +

    str_locate() str_locate_all()

    + +

    Locate the position of patterns in a string.

    + + + +

    str_match() str_match_all()

    + +

    Extract matched groups from a string.

    + + + +

    str_replace() str_replace_all()

    + +

    Replace matched patterns in a string.

    + + + +

    str_split() str_split_fixed()

    + +

    Split up a string into pieces.

    + + + +

    str_subset() str_which()

    + +

    Keep strings matching a pattern, or find positions.

    + + + +

    str_view() str_view_all()

    + +

    View HTML rendering of regular expression match.

    + + + +

    fixed() coll() regex() boundary()

    + +

    Control matching behaviour with modifier functions.

    + + + + +

    Whitespace

    +

    + + + + + +

    str_pad()

    + +

    Pad a string.

    + + + +

    str_trim() str_squish()

    + +

    Trim whitespace from a string

    + + + +

    str_wrap()

    + +

    Wrap strings into nicely formatted paragraphs.

    + + + + +

    Locale senstive

    +

    + + + + + +

    str_order() str_sort()

    + +

    Order or sort a character vector.

    + + + +

    str_to_upper() str_to_lower() str_to_title()

    + +

    Convert case of a string.

    + + + + +

    Other helpers

    +

    + + + + + +

    invert_match()

    + +

    Switch location of matches to location of non-matches.

    + + + +

    str_c()

    + +

    Join multiple strings into a single string.

    + + + +

    str_conv()

    + +

    Specify the encoding of a string.

    + + + +

    str_dup()

    + +

    Duplicate and concatenate strings within a character vector.

    + + + +

    str_glue() str_glue_data()

    + +

    Format and interpolate a string with glue

    + + + +

    str_length()

    + +

    The length of a string.

    + + + +

    str_replace_na()

    + +

    Turn NA into "NA"

    + + + +

    str_trunc()

    + +

    Truncate a character string.

    + + + +

    str_sub() `str_sub<-`()

    + +

    Extract and replace substrings from a character vector.

    + + + +

    word()

    + +

    Extract words from a sentence.

    + + + + +

    Bundled data

    +

    + + + + + +

    sentences fruit words

    + +

    Sample character vectors for practicing string manipulations.

    + + +
    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/reference/invert_match.html b/docs/reference/invert_match.html index 99a8d38e..cb312949 100644 --- a/docs/reference/invert_match.html +++ b/docs/reference/invert_match.html @@ -97,20 +97,24 @@ -
    +
    +

    Invert a matrix of match locations to match the opposite of what was previously matched.

    +
    invert_match(loc)
    -

    Arguments

    +

    Arguments

    @@ -150,21 +154,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/modifiers.html b/docs/reference/modifiers.html index 06afaa47..0309ad65 100644 --- a/docs/reference/modifiers.html +++ b/docs/reference/modifiers.html @@ -97,12 +97,15 @@ -
    +
    +
    fixed

    Compare literal bytes in the string. This is very fast, but @@ -112,6 +115,7 @@

    Control matching behaviour with modifier functions.

    boundary

    Match boundaries between things.

    +
    fixed(pattern, ignore_case = FALSE)
     
    @@ -123,7 +127,7 @@ 

    Control matching behaviour with modifier functions.

    boundary(type = c("character", "line_break", "sentence", "word"), skip_word_none = NA, ...)
    -

    Arguments

    +

    Arguments

    @@ -165,7 +169,15 @@

    Ar

    - + @@ -175,6 +187,12 @@

    Ar

    type

    Boundary type to detect.

    Boundary type to detect.

    +
    character

    Every character is a boundary.

    +
    line_break

    Boundaries are places where it is acceptable to have +a line break in the current locale.

    +
    sentence

    The beginnings and ends of sentences are boundaries, +using intelligent rules to avoid counting abbreviations +(details).

    +
    word

    The beginnings and ends of words are boundaries.

    +
    skip_word_none
    +

    See also

    + +

    str_wrap() for breaking text to form paragraphs

    +

    stringi::stringi-search-boundaries for more detail on the +various boundaries

    +

    Examples

    pattern <- "a.b" @@ -207,7 +225,9 @@

    Examp

    Contents

    @@ -220,21 +240,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/reference/pipe.html b/docs/reference/pipe.html index 4a8c86f0..0450b179 100644 --- a/docs/reference/pipe.html +++ b/docs/reference/pipe.html @@ -97,15 +97,19 @@ -
    +
    +

    Pipe operator

    +
    lhs %>% rhs
    @@ -125,21 +129,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/reference/str_c.html b/docs/reference/str_c.html index c2bc039f..55f93832 100644 --- a/docs/reference/str_c.html +++ b/docs/reference/str_c.html @@ -97,25 +97,28 @@ -
    +
    +
    -

    To understand how str_c works, you need to imagine that you are -building up a matrix of strings. Each input argument forms a column, and -is expanded to the length of the longest argument, using the usual -recyling rules. The sep string is inserted between each column. If -collapse is NULL each row is collapsed into a single string. If -non-NULL that string is inserted at the end of each row, and -the entire matrix collapsed to a single string.

    +

    To understand how str_c works, you need to imagine that you are building up +a matrix of strings. Each input argument forms a column, and is expanded to +the length of the longest argument, using the usual recyling rules. The +sep string is inserted between each column. If collapse is NULL each row +is collapsed into a single string. If non-NULL that string is inserted at +the end of each row, and the entire matrix collapsed to a single string.

    +
    str_c(..., sep = "", collapse = NULL)
    -

    Arguments

    +

    Arguments

    @@ -147,8 +150,8 @@

    Value

    See also

    -

    paste() for equivalent base R functionality, and -stringi::stri_join() which this function wraps

    +

    paste() for equivalent base R functionality, and +stringi::stri_join() which this function wraps

    Examples

    @@ -198,21 +201,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_conv.html b/docs/reference/str_conv.html index 2a25bc88..17a98f47 100644 --- a/docs/reference/str_conv.html +++ b/docs/reference/str_conv.html @@ -97,19 +97,23 @@ -
    +
    +

    This is a convenient way to override the current encoding of a string.

    +
    str_conv(string, encoding)
    -

    Arguments

    +

    Arguments

    @@ -146,21 +150,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_count.html b/docs/reference/str_count.html index 2541a08e..190ec6c0 100644 --- a/docs/reference/str_count.html +++ b/docs/reference/str_count.html @@ -97,19 +97,23 @@ -
    +
    +

    Vectorised over string and pattern.

    +
    str_count(string, pattern = "")
    -

    Arguments

    +

    Arguments

    @@ -139,9 +143,9 @@

    Value

    See also

    -

    stringi::stri_count() which this function wraps. - str_locate()/str_locate_all() to locate position -of matches

    +

    stringi::stri_count() which this function wraps.

    +

    str_locate()/str_locate_all() to locate position +of matches

    Examples

    @@ -170,21 +174,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_detect.html b/docs/reference/str_detect.html index ec200c80..14847102 100644 --- a/docs/reference/str_detect.html +++ b/docs/reference/str_detect.html @@ -97,19 +97,23 @@ -
    +
    +

    Vectorised over string and pattern.

    +
    str_detect(string, pattern)
    -

    Arguments

    +

    Arguments

    @@ -139,9 +143,9 @@

    Value

    See also

    -

    stringi::stri_detect() which this function wraps, +

    stringi::stri_detect() which this function wraps, str_subset() for a convenient wrapper around -x[str_detect(x, pattern)]

    +x[str_detect(x, pattern)]

    Examples

    @@ -173,21 +177,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_dup.html b/docs/reference/str_dup.html index 7a32f6e8..1495774c 100644 --- a/docs/reference/str_dup.html +++ b/docs/reference/str_dup.html @@ -97,19 +97,23 @@ -
    +
    +

    Vectorised over string and times.

    +
    str_dup(string, times)
    -

    Arguments

    +

    Arguments

    @@ -151,21 +155,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_extract.html b/docs/reference/str_extract.html index 456dc0b1..25d0b7fb 100644 --- a/docs/reference/str_extract.html +++ b/docs/reference/str_extract.html @@ -97,21 +97,25 @@ -
    +
    +

    Vectorised over string and pattern.

    +
    str_extract(string, pattern)
     
     str_extract_all(string, pattern, simplify = FALSE)
    -

    Arguments

    +

    Arguments

    @@ -146,8 +150,8 @@

    Value

    See also

    -

    str_match() to extract matched groups; -stringi::stri_extract() for the underlying implementation.

    +

    str_match() to extract matched groups; +stringi::stri_extract() for the underlying implementation.

    Examples

    @@ -224,21 +228,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_flatten.html b/docs/reference/str_flatten.html index c6438ad1..132307b4 100644 --- a/docs/reference/str_flatten.html +++ b/docs/reference/str_flatten.html @@ -97,19 +97,23 @@ -
    +
    +

    Flatten a string

    +
    str_flatten(string, collapse = "")
    -

    Arguments

    +

    Arguments

    @@ -149,21 +153,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_glue.html b/docs/reference/str_glue.html index f007ed3a..30d1322f 100644 --- a/docs/reference/str_glue.html +++ b/docs/reference/str_glue.html @@ -97,48 +97,52 @@ -
    +
    +

    These functions are wrappers around glue::glue() and glue::glue_data(), which provide a powerful and elegant syntax for interpolating strings. These wrappers provide a small set of the full options. Use the functions directly from glue for more control.

    +
    str_glue(..., .sep = "", .envir = parent.frame())
     
     str_glue_data(.x, ..., .sep = "", .envir = parent.frame(), .na = "NA")
    -

    Arguments

    +

    Arguments

    - + - + - - + -
    ...

    [expressions] Expressions string(s) to format, multiple inputs are concatenated together before formatting.

    [expressions]
    Expressions string(s) to format, multiple inputs are concatenated together before formatting.

    .sep

    [character(1): ‘""’] Separator used to separate elements.

    [character(1): ‘""’]
    Separator used to separate elements.

    .envir

    [environment: parent.frame()] Environment to evaluate each expression in. Expressions are +

    [environment: parent.frame()]
    Environment to evaluate each expression in. Expressions are evaluated from left to right. If .x is an environment, the expressions are evaluated in that environment and .envir is ignored.

    .x

    [listish] An environment, list or data frame used to lookup values.

    [listish]
    An environment, list or data frame used to lookup values.

    .na

    [character(1): ‘NA’] Value to replace NA values -with. If NULL missing values are propegated, that is an NA result will +

    [character(1): ‘NA’]
    Value to replace NA values +with. If NULL missing values are propagated, that is an NA result will cause NA output. Otherwise the value is replaced by the value of .na.

    @@ -213,21 +217,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/reference/str_interp.html b/docs/reference/str_interp.html index 938d8e71..a0a07dd1 100644 --- a/docs/reference/str_interp.html +++ b/docs/reference/str_interp.html @@ -97,12 +97,15 @@ -
    +
    +

    String interpolation is a useful way of specifying a character string which depends on values in a certain environment. It allows for string creation @@ -113,10 +116,11 @@

    String interpolation.

    can be evaluated in the given environment, and format is a format specification valid for use with sprintf().

    +
    str_interp(string, env = parent.frame())
    -

    Arguments

    +

    Arguments

    @@ -136,8 +140,8 @@

    Value

    See also

    -

    str_glue() and str_glue_data() for alternative approaches to -the same problem.

    +

    str_glue() and str_glue_data() for alternative approaches to +the same problem.

    Examples

    @@ -192,21 +196,23 @@

    Author

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_length.html b/docs/reference/str_length.html index 778ccdbf..1c03c8d5 100644 --- a/docs/reference/str_length.html +++ b/docs/reference/str_length.html @@ -97,22 +97,26 @@ -
    +
    +

    Technically this returns the number of "code points", in a string. One code point usually corresponds to one character, but not always. For example, an u with a umlaut might be represented as a single character or as the combination a u and an umlaut.

    +
    str_length(string)
    -

    Arguments

    +

    Arguments

    @@ -129,7 +133,7 @@

    Value

    See also

    -

    stringi::stri_length() which this function wraps.

    +

    stringi::stri_length() which this function wraps.

    Examples

    @@ -163,21 +167,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_locate.html b/docs/reference/str_locate.html index e9e768db..dcc81208 100644 --- a/docs/reference/str_locate.html +++ b/docs/reference/str_locate.html @@ -97,23 +97,27 @@ -
    +
    +

    Vectorised over string and pattern. If the match is of length 0, (e.g. from a special match like $) end will be one character less than start.

    +
    str_locate(string, pattern)
     
     str_locate_all(string, pattern)
    -

    Arguments

    +

    Arguments

    @@ -145,8 +149,8 @@

    Value

    See also

    -

    str_extract() for a convenient way of extracting matches, -stringi::stri_locate() for the underlying implementation.

    +

    str_extract() for a convenient way of extracting matches, +stringi::stri_locate() for the underlying implementation.

    Examples

    @@ -277,21 +281,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_match.html b/docs/reference/str_match.html index cac0f913..df72670c 100644 --- a/docs/reference/str_match.html +++ b/docs/reference/str_match.html @@ -97,21 +97,25 @@ -
    +
    +

    Vectorised over string and pattern.

    +
    str_match(string, pattern)
     
     str_match_all(string, pattern)
    -

    Arguments

    +

    Arguments

    @@ -134,9 +138,9 @@

    Value

    See also

    -

    str_extract() to extract the complete match, +

    str_extract() to extract the complete match, stringi::stri_match() for the underlying -implementation.

    +implementation.

    Examples

    @@ -307,21 +311,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_order.html b/docs/reference/str_order.html index 3f6fe243..338c545b 100644 --- a/docs/reference/str_order.html +++ b/docs/reference/str_order.html @@ -97,15 +97,19 @@ -
    +
    +

    Order or sort a character vector.

    +
    str_order(x, decreasing = FALSE, na_last = TRUE, locale = "en",
       numeric = FALSE, ...)
    @@ -113,7 +117,7 @@ 

    Order or sort a character vector.

    str_sort(x, decreasing = FALSE, na_last = TRUE, locale = "en", numeric = FALSE, ...)
    -

    Arguments

    +

    Arguments

    @@ -150,7 +154,7 @@

    Ar

    See also

    -

    stringi::stri_order() for the underlying implementation.

    +

    stringi::stri_order() for the underlying implementation.

    Examples

    @@ -182,21 +186,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_pad.html b/docs/reference/str_pad.html index 26f0cf0b..03309bff 100644 --- a/docs/reference/str_pad.html +++ b/docs/reference/str_pad.html @@ -97,19 +97,23 @@ -
    +
    +

    Vectorised over string, width and pad.

    +
    str_pad(string, width, side = c("left", "right", "both"), pad = " ")
    -

    Arguments

    +

    Arguments

    @@ -136,8 +140,8 @@

    Value

    See also

    -

    str_trim() to remove whitespace; -str_trunc() to decrease the maximum width of a string.

    +

    str_trim() to remove whitespace; +str_trunc() to decrease the maximum width of a string.

    Examples

    @@ -175,21 +179,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_remove.html b/docs/reference/str_remove.html index b5153ed0..92ec2a95 100644 --- a/docs/reference/str_remove.html +++ b/docs/reference/str_remove.html @@ -97,21 +97,25 @@ -
    +
    +
    str_remove(string, pattern)
     
     str_remove_all(string, pattern)
    -

    Arguments

    +

    Arguments

    @@ -141,7 +145,7 @@

    Value

    See also

    -

    str_replace() for the underlying implementation.

    +

    str_replace() for the underlying implementation.

    Examples

    @@ -169,21 +173,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_replace.html b/docs/reference/str_replace.html index 9fa5c044..a1d41f13 100644 --- a/docs/reference/str_replace.html +++ b/docs/reference/str_replace.html @@ -97,21 +97,25 @@ -
    +
    +

    Vectorised over string, pattern and replacement.

    +
    str_replace(string, pattern, replacement)
     
     str_replace_all(string, pattern, replacement)
    -

    Arguments

    +

    Arguments

    @@ -128,10 +132,7 @@

    Ar

    Match a fixed string (i.e. by comparing only bytes), using fixed(). This is fast, but approximate. Generally, for matching human text, you'll want coll() which -respects character matching rules for the specified locale.

    -

    Match character, word, line and sentence boundaries with -boundary(). An empty pattern, "", is equivalent to -boundary("character").

    +respects character matching rules for the specified locale.

    @@ -155,8 +156,8 @@

    Value

    See also

    -

    str_replace_na() to turn missing values into "NA"; -stri_replace() for the underlying implementation.

    +

    str_replace_na() to turn missing values into "NA"; +stri_replace() for the underlying implementation.

    Examples

    @@ -204,21 +205,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_replace_na.html b/docs/reference/str_replace_na.html index 1f902f71..765b58e7 100644 --- a/docs/reference/str_replace_na.html +++ b/docs/reference/str_replace_na.html @@ -97,19 +97,23 @@ -
    +
    +

    Turn NA into "NA"

    +
    str_replace_na(string, replacement = "NA")
    -

    Arguments

    +

    Arguments

    replacement
    @@ -144,21 +148,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_split.html b/docs/reference/str_split.html index c3ccf869..a67f3842 100644 --- a/docs/reference/str_split.html +++ b/docs/reference/str_split.html @@ -97,21 +97,25 @@ -
    +
    +

    Vectorised over string and pattern.

    +
    str_split(string, pattern, n = Inf, simplify = FALSE)
     
     str_split_fixed(string, pattern, n)
    -

    Arguments

    +

    Arguments

    @@ -154,7 +158,7 @@

    Value

    See also

    -

    stri_split() for the underlying implementation.

    +

    stri_split() for the underlying implementation.

    Examples

    @@ -217,21 +221,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_sub.html b/docs/reference/str_sub.html index b89f7102..00aeffd0 100644 --- a/docs/reference/str_sub.html +++ b/docs/reference/str_sub.html @@ -97,23 +97,27 @@ -
    +
    +

    str_sub will recycle all arguments to be the same length as the longest argument. If any arguments are of length 0, the output will be a zero length character vector.

    +
    str_sub(string, start = 1L, end = -1L)
     
     str_sub(string, start = 1L, end = -1L, omit_na = FALSE) <- value
    -

    Arguments

    +

    Arguments

    @@ -152,7 +156,7 @@

    Details

    See also

    -

    The underlying implementation in stringi::stri_sub()

    +

    The underlying implementation in stringi::stri_sub()

    Examples

    @@ -208,21 +212,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_subset.html b/docs/reference/str_subset.html index f5878bf3..e399eab5 100644 --- a/docs/reference/str_subset.html +++ b/docs/reference/str_subset.html @@ -97,24 +97,28 @@ -
    +
    +

    str_subset() is a wrapper around x[str_detect(x, pattern)], and is equivalent to grep(pattern, x, value = TRUE). str_which() is a wrapper around which(str_detect(x, pattern)), and is equivalent to grep(pattern, x).

    +
    str_subset(string, pattern)
     
     str_which(string, pattern)
    -

    Arguments

    +

    Arguments

    @@ -148,8 +152,8 @@

    Details

    See also

    -

    grep() with argument value = TRUE, -stringi::stri_subset() for the underlying implementation.

    +

    grep() with argument value = TRUE, +stringi::stri_subset() for the underlying implementation.

    Examples

    @@ -182,21 +186,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_trim.html b/docs/reference/str_trim.html index 1aa7b883..b164b2a7 100644 --- a/docs/reference/str_trim.html +++ b/docs/reference/str_trim.html @@ -97,22 +97,26 @@ -
    +
    +

    str_trim() removes whitespace from start and end of string; str_squish() also reduces repeated whitespace inside a string.

    +
    str_trim(string, side = c("both", "left", "right"))
     
     str_squish(string)
    -

    Arguments

    +

    Arguments

    @@ -131,7 +135,7 @@

    Value

    See also

    -

    str_pad() to add whitespace

    +

    str_pad() to add whitespace

    Examples

    @@ -159,21 +163,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_trunc.html b/docs/reference/str_trunc.html index 9c9322df..2310598d 100644 --- a/docs/reference/str_trunc.html +++ b/docs/reference/str_trunc.html @@ -97,20 +97,24 @@ -
    +
    +

    Truncate a character string.

    +
    str_trunc(string, width, side = c("right", "left", "center"),
       ellipsis = "...")
    -

    Arguments

    +

    Arguments

    @@ -130,7 +134,7 @@

    Ar

    See also

    -

    str_pad() to increase the minimum width of a string.

    +

    str_pad() to increase the minimum width of a string.

    Examples

    @@ -164,21 +168,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_view.html b/docs/reference/str_view.html index c4faeebb..76ddc950 100644 --- a/docs/reference/str_view.html +++ b/docs/reference/str_view.html @@ -97,22 +97,26 @@ -
    +
    +

    str_view shows the first match; str_view_all shows all the matches.

    +
    str_view(string, pattern, match = NA)
     
     str_view_all(string, pattern, match = NA)
    -

    Arguments

    +

    Arguments

    @@ -144,11 +148,17 @@

    Ar

    Examples

    -
    str_view(c("abc", "def", "fgh"), "[aeiou]")
    #> Error in yaml.load(readLines(con), error.label = error.label, ...): argument "error.label" is missing, with no default
    str_view(c("abc", "def", "fgh"), "^")
    #> Error in yaml.load(readLines(con), error.label = error.label, ...): argument "error.label" is missing, with no default
    str_view(c("abc", "def", "fgh"), "..")
    #> Error in yaml.load(readLines(con), error.label = error.label, ...): argument "error.label" is missing, with no default
    +
    str_view(c("abc", "def", "fgh"), "[aeiou]") +str_view(c("abc", "def", "fgh"), "^") +str_view(c("abc", "def", "fgh"), "..") + # Show all matches with str_view_all -str_view_all(c("abc", "def", "fgh"), "d|e")
    #> Error in yaml.load(readLines(con), error.label = error.label, ...): argument "error.label" is missing, with no default
    +str_view_all(c("abc", "def", "fgh"), "d|e") + # Use match to control what is shown -str_view(c("abc", "def", "fgh"), "d|e")
    #> Error in yaml.load(readLines(con), error.label = error.label, ...): argument "error.label" is missing, with no default
    str_view(c("abc", "def", "fgh"), "d|e", match = TRUE)
    #> Error in yaml.load(readLines(con), error.label = error.label, ...): argument "error.label" is missing, with no default
    str_view(c("abc", "def", "fgh"), "d|e", match = FALSE)
    #> Error in yaml.load(readLines(con), error.label = error.label, ...): argument "error.label" is missing, with no default
    +str_view(c("abc", "def", "fgh"), "d|e") +str_view(c("abc", "def", "fgh"), "d|e", match = TRUE) +str_view(c("abc", "def", "fgh"), "d|e", match = FALSE)
    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/str_wrap.html b/docs/reference/str_wrap.html index b7d305c6..30493be1 100644 --- a/docs/reference/str_wrap.html +++ b/docs/reference/str_wrap.html @@ -97,20 +97,24 @@ -
    +
    +

    This is a wrapper around stringi::stri_wrap() which implements the Knuth-Plass paragraph wrapping algorithm.

    +
    str_wrap(string, width = 80, indent = 0, exdent = 0)
    -

    Arguments

    +

    Arguments

    @@ -426,21 +430,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + + diff --git a/docs/reference/stringr-data.html b/docs/reference/stringr-data.html index 6ca41cbe..7a9d7d0f 100644 --- a/docs/reference/stringr-data.html +++ b/docs/reference/stringr-data.html @@ -97,12 +97,15 @@ -
    +
    +

    fruit and word come from the rcorpora package written by Gabor Csardi; the data was collected by Darius Kazemi @@ -110,6 +113,7 @@

    Sample character vectors for practicing string manipulations.

    sentences is a collection of "Harvard sentences" used for standardised testing of voice.

    +
    sentences
     
    @@ -149,21 +153,23 @@ 

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/reference/stringr-package.html b/docs/reference/stringr-package.html index bfd9931f..9d84d8dc 100644 --- a/docs/reference/stringr-package.html +++ b/docs/reference/stringr-package.html @@ -97,12 +97,15 @@ -
    +
    +

    A consistent, simple and easy to use set of wrappers around the fantastic 'stringi' package. All function and argument names (and positions) @@ -110,15 +113,16 @@

    stringr: Simple, Consistent Wrappers for Common String Operations

    in the same way, and the output from one function is easy to feed into the input of another.

    +

    See also

    -

    Useful links:

    @@ -148,21 +152,23 @@

    Author

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    +
    + + + diff --git a/docs/reference/word.html b/docs/reference/word.html index 04f52ff1..9b7ef7e7 100644 --- a/docs/reference/word.html +++ b/docs/reference/word.html @@ -97,19 +97,23 @@ -
    +
    +

    Extract words from a sentence.

    +
    word(string, start = 1L, end = start, sep = fixed(" "))
    -

    Arguments

    +

    Arguments

    @@ -168,21 +172,23 @@

    Contents

    -

    Developed by Hadley Wickham, .

    +

    Developed by Hadley Wickham, RStudio.

    Site built by pkgdown.

    + + + +