If the element does not exist, this function returns the empty string. This is consistent with stringr::str_sub(). This function is vectorised over both arguments.
stringr::str_sub()
str_elem(string, index)
A character vector.
An integer. Negative indexing is allowed as in stringr::str_sub().
A one-character string.
Other single element extractors: str_elems, str_paste_elems
str_elems
str_paste_elems
# NOT RUN { str_elem(c("abcd", "xyz"), 3) str_elem("abcd", -2) # }
Run the code above in your browser using DataLab