countWords: Count the number of words in each item in a vector or list

View source: R/countWords.R

countWordsR Documentation

Count the number of words in each item in a vector or list

Description

This function determines how many words are in a string; it assumes that words are separated by either a space or a hyphen.

Usage

countWords(x)

Arguments

x

A vector or list. This can be any type of data.

Value

Returns a vector of numbers that is the number of words present

Examples


countWords("My cats' names are Lightning and Theo.")
countWords(list("My cats' names are Lightning and Theo.",
              "mein hindee seekh rahi hoon", 4.5, TRUE,
              "Pharmacogenetic variation in drug-metabolizing enzymes"))


shirewoman2/LaurasHelpers documentation built on Oct. 22, 2023, 2:07 p.m.