left | R Documentation |
Inspired by the Excel function with the same name.
left(string, n)
string |
a vector of strings |
n |
a vector of integers (will be recycled, if needed) |
The first n
characters of each value in string
.
If n
has length 1, then that value is applied to all strings
because of recycling.
However, n
can have more than one element!
left('lazy dog', 4)
left(c('lazy dog', 'blue dog'), 4)
left(c('lazy dog', 'red dog'), c(4, 3))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.