first_right.Rd
This function returns the first n words of a string (by default, five). This can, for example, be helpful for extracting words from the right context column of a concordance data frame.
first_right(x, column, n = 5, omit_punctuation = TRUE)
x | A vector or data frame. |
---|---|
column | If x is a data frame, the number or name of the column. |
n | number of words to return. Default is 5. |
omit_punctuation | If TRUE (the default), strings consisting exclusively of non-alphanumeric characters will be omitted. |
A vector containing the last n words of each vector element.