I have a dataframe, with a lot of trigrams and their frequencies.
How can I add a third column (let's called it finalWord) where only the last word of the trigram is displayed?
Here is an example of the dataframe:
x <- data.frame(trigrams = c("I have to", "I need to"), freq = c(10, 7))
The output should be:
x <- data.frame(trigrams = c("I have to", "I need to"), freq = c(10, 7), finalWord = c("to", "to"))