Learn R Programming

ds4psy (version 0.4.0)

count_chars: count_chars counts the frequency of characters in a string of text x.

Description

count_chars counts the frequency of characters in a string of text x.

Usage

count_chars(x, case_sense = TRUE, rm_specials = TRUE, sort_freq = TRUE)

Arguments

x

A string of text (required).

case_sense

Boolean: Distinguish lower- vs. uppercase characters? Default: case_sense = TRUE.

rm_specials

Boolean: Remove special characters? Default: rm_specials = TRUE.

sort_freq

Boolean: Sort output by character frequency? Default: sort_freq = TRUE.

See Also

count_words for counting the frequency of words; plot_text for a corresponding plot function.

Other text objects and functions: Umlaut, capitalize(), caseflip(), cclass, count_words(), l33t_rul35, metachar, read_ascii(), text_to_sentences(), text_to_words(), transl33t()

Examples

Run this code
# NOT RUN {
# Default: 
x <- c("Hello!", "This is a 1st sentence.", "This is the 2nd sentence.", "The end.")
count_chars(x)

# Options: 
count_chars(x, case_sense = FALSE)
count_chars(x, rm_specials = FALSE)
count_chars(x, sort_freq = FALSE)
 
# }

Run the code above in your browser using DataLab