Strings | R Documentation |
C++ implemetations of convenience functions for strings. All functions but strTake
operate with O(1) memory.
strHead
returns the first character of a string
strHeadLower
returns the first character of a string coerced to lower case
strTail
returns all but the first character of a string
strTake
returns the first n
characters of a string
strDrop
returns all but the first n
characters of a string
strHead(s)
strHeadLower(s)
strTail(s)
strTake(s, n)
strDrop(s, n)
s |
a string object |
n |
the number of characters to take or drop |
A few convenient list operations, tailored to 8-bit-character strings.
A character vector.
While originally also implemented for performance reasons, the built-in substr
function is usually faster due to the Call-overhead. At least for R 3.x onward the built-in functions should be preferred when performance is an issue. See the vignette for details.
strHead("Gnu")
strHeadLower("Gnu")
strTail("Gnu")
strTake("Gnus and Gnats",3)
strDrop("Gnus and Gnats",9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.