Extract the first (or last) n characters of a string January 2, 2023 by Tarik See ?substr R> substr(a, 1, 4) [1] "left"