str_elems | R Documentation |
Efficiently extract several elements from a string. See str_elem()
for
extracting single elements. This function is vectorized over the first
argument.
str_elems(string, indices, byrow = TRUE)
string |
A character vector. |
indices |
A vector of integerish values. Negative indexing is allowed as
in |
byrow |
Should the elements be organised in the matrix with one row per
string ( |
A character matrix.
Other single element extractors:
str_elem()
,
str_paste_elems()
string <- c("abc", "def", "ghi", "vwxyz")
str_elems(string, 1:2)
str_elems(string, 1:2, byrow = FALSE)
str_elems(string, c(1, 2, 3, 4, -1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.