first_right: get the first n words of a string

View source: R/first_right.R

first_rightR Documentation

get the first n words of a string

Description

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.

Usage

first_right(x, column, n = 5, omit_punctuation = TRUE)

Arguments

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.

Value

A vector containing the last n words of each vector element.


hartmast/concordances documentation built on April 19, 2023, 9:39 p.m.