count_chars_words | R Documentation |
x
.count_chars_words
provides frequency counts of the
characters and words of a string of text x
on a per character basis.
count_chars_words(x, case_sense = TRUE, sep = "|", rm_sep = TRUE)
x |
A string of text (required). |
case_sense |
Boolean: Distinguish lower- vs. uppercase characters?
Default: |
sep |
Dummy character(s) to insert between elements/lines
when parsing a multi-element character vector |
rm_sep |
Should |
count_chars_words
calls both count_chars
and
count_words
and maps their results
to a data frame that contains a row for each
character of x
.
The quantifications are case-sensitive. Special characters (e.g., parentheses, punctuation, and spaces) are counted as characters, but removed from word counts.
If input x
consists of multiple text strings,
they are collapsed with an added " " (space) between them.
A data frame with 4 variables
(char
, char_freq
, word
, word_freq
).
count_chars
for counting the frequency of characters;
count_words
for counting the frequency of words;
plot_chars
for a character plotting function.
Other text objects and functions:
Umlaut
,
capitalize()
,
caseflip()
,
cclass
,
chars_to_text()
,
collapse_chars()
,
count_chars()
,
count_words()
,
invert_rules()
,
l33t_rul35
,
map_text_chars()
,
map_text_coord()
,
map_text_regex()
,
metachar
,
read_ascii()
,
text_to_chars()
,
text_to_sentences()
,
text_to_words()
,
transl33t()
,
words_to_text()
s1 <- ("This test is to test this function.")
head(count_chars_words(s1))
head(count_chars_words(s1, case_sense = FALSE))
s3 <- c("A 1st sentence.", "The 2nd sentence.",
"A 3rd --- and also THE FINAL --- SENTENCE.")
tail(count_chars_words(s3))
tail(count_chars_words(s3, case_sense = FALSE))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.