Learn R Programming

ds4psy (version 0.2.0)

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

Description

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

Usage

count_char(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

plot_text for a corresponding plot function.

Other text functions: capitalize(), caseflip(), l33t_rul35, read_ascii(), transl33t()

Examples

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

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

Run the code above in your browser using DataLab