x <- sprintf("%s%s", LETTERS, 1:26)
txt_previous(x, n = 1)
data.frame(word = x,
word_previous1 = txt_previous(x, n = 1),
word_previous2 = txt_previous(x, n = 2),
stringsAsFactors = FALSE)
Run the code above in your browser using DataLab