countSpaces: Count the Spaces in a Character String

View source: R/ThirdPartyFunctions.R

countSpacesR Documentation

Count the Spaces in a Character String

Description

Counts the number of spaces in a character string.

Usage

countSpaces(x)

Arguments

x

A character string.

Value

A vector of numeric values identifying the number of instances of spaces (' ') in x, and the number of consecutive spaces in an instance.

Author(s)

Josh Bredeweg, Reddit user jbraids1421

Source

https://www.reddit.com/r/rstats/comments/2th8ic/function_to_count_the_number_of_white_spaces/

Examples

countSpaces("abc def")
countSpaces("abc def  ghi   jkl mno")


HLAtools documentation built on June 8, 2025, 12:24 p.m.