I want to extract the first (or last) n characters of a string. This would be the equivalent to Excel's LEFT() and RIGHT(). A small example:
# create a string
a <- paste('left', 'right', sep = '')
#  "leftright"
I would like to produce b, a string which is equal to the first 4 letters of a:
#  "left"
What should I do?