Get the n-th previous element of a vector
Get the n-th previous element of a vector
txt_previous(x, n = 1)
x |
a character vector where each element is just 1 term or word |
n |
an integer indicating how far to look back. Defaults to 1. |
a character vector of the same length of x
with the previous element
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)
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.