extractWord: Extract a vector of the n-th word by location from a vector...

View source: R/extractWord.R

extractWordR Documentation

Extract a vector of the n-th word by location from a vector of character strings

Description

Function to extract a vector of the n-th word by location from a vector of character strings.

Usage

extractWord(x, which = 1, split = " ")

Arguments

x
  • a vector of character strings

which
  • integer indicating which word, by position, to extract

split
  • character string by which to define words

Details

Uses strsplit(x,split,fixed=TRUE) to split each character string in x into a list of vectors of 'words', then extracts the n-th word from each list element (where n is the input value of which). If a list element has less than which words, the associated value in the returned vector will be "".

Value

a vector of words extracted bby location from x (of length(x))


wStockhausen/wtsUtilities documentation built on March 16, 2024, 10:38 a.m.