str_paste_elems | R Documentation |
This is a quick way around doing a call to str_elems()
followed by a call
of apply(..., paste)
.
str_paste_elems(string, indices, sep = "")
string |
A character vector. |
indices |
A vector of integerish values. Negative indexing is allowed as
in |
sep |
A string. The separator for pasting |
Elements that don't exist e.g. element 5 of "abc"
are ignored.
A character vector.
Other single element extractors:
str_elem()
,
str_elems()
string <- c("abc", "def", "ghi", "vwxyz")
str_paste_elems(string, 1:2)
str_paste_elems(string, c(1, 2, 3, 4, -1))
str_paste_elems("abc", c(1, 5, 55, 43, 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.