qw | R Documentation |
This function splits one or more character strings into words. By default,
the strings are split on whitespace in order to emulate Perl's qw()
(quote words) functionality.
qw(s, sep="\\s+", names=FALSE)
s |
one or more strings to be split (a character vector) |
sep |
PCRE regular expression on which to split (defaults to whitespace) |
names |
if TRUE, the resulting character vector is labelled with itself, which is convenient for |
A character vector of the resulting words. Multiple strings in s
are flattened into a single vector.
If names=TRUE
, the words are used both as values and as labels of the character vectors, which is convenient when iterating over it with lapply
or sapply
.
Stephanie Evert (https://purl.org/stephanie.evert)
qw(c("alpha beta gamma", "42 111" ))
qw("alpha beta gamma", names=TRUE)
qw("words with blanks, sep by commas", sep="\\s*,\\s*")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.