count_chr_words: Counts words and characters in a string

Description Usage Arguments Value Examples

View source: R/count_chr_words.R

Description

This function counts the number of words and characters in a given string. The user can decide weather to count spaces as characters or not.

Usage

1
count_chr_words(text, count_spaces)

Arguments

text

The string whose words and characters will be counted. Parameter is called text since it makes intuitive sense to the user (they are inputting written text).

count_spaces

Weather spaces in the string should be counted as characters (TRUE or FALSE). count_spaces is pretty self explanatory. We are asking the user if they should count spaces as character or not.

Value

A numeric vector whose first element is the number of words in the string and second element is number of characters in the string. c(words, characters)

Examples

1
2
count_chr_words("hello world", count_spaces = TRUE)
count_chr_words("AATTCCTTTCGGTG", count_spaces = FALSE)

jburckhardt/WordsChars documentation built on Dec. 20, 2021, 10:02 p.m.