Learn R Programming

qdap (version 0.2.5)

word_stats: Descriptive Word Statistics

Description

Transcript apply descriptive word statistics.

Usage

word_stats(text.var, grouping.var = NULL, tot = NULL,
    parallel = FALSE, rm.incomplete = FALSE,
    digit.remove = FALSE, apostrophe.remove = FALSE,
    digits = 3, ...)

Arguments

text.var
The text variable or a "word_stats" object (i.e., the output of a word_stats function).
grouping.var
The grouping variables. Default NULL generates one word list for all text. Also takes a single grouping variable or a list of 1 or more grouping variables.
tot
Optional turns of talk variable that yields turn of talk measures.
parallel
logical. If TRUE attempts to run the function on multiple cores. Note that this may not mean a speed boost if you have one core or if the data set is smaller as the cluster takes time to create (parallel is slower until approxim
rm.incomplete
logical. If TRUE incomplete statements are removed from calculations in the output.
digit.remove
logical. If TRUE removes digits from calculating the output.
apostrophe.remove
logical. If TRUE removes apostrophes from calculating the output.
digits
Integer; number of decimal places to round when printing.
...
Any other arguments passed to end_inc.

Value

  • Returns a list of three descriptive word statistics:
  • tsA data frame of descriptive word statistics by row
  • gtsA data frame of word/sentence statistics per grouping variable:
    • n.tot
    { - number of turns of talk} n.sent{ - number of sentences} n.words{ - number of words} n.char{ - number of characters} n.syl{ - number of syllables} n.poly{ - number of polysyllables} sptot{ - syllables per turn of talk} wptot{ - words per turn of talk} wps{ - words per sentence} cps{ - characters per sentence} sps{ - syllables per sentence} psps{ - poly-syllables per sentence} cpw{ - characters per word} spw{ - syllables per word} n.state{ - number of statements} n.quest{ - number of questions} n.exclm{ - number of exclamations} n.incom{ - number of incomplete statements} p.state{ - proportion of statements} p.quest{ - proportion of questions} p.exclm{ - proportion of exclamations} p.incom{ - proportion of incomplete statements} n.hapax{ - number of hapax legomenon} n.dis{ - number of dis legomenon} grow.rate{ - proportion of hapax legomenon to words} prop.dis{ - proportion of dis legomenon to words}

item

  • mpun
  • word.elem
  • sent.elem
  • omit
  • percent
  • zero.replace
  • digits

Examples

Run this code
word_stats(mraja1spl$dialogue, mraja1spl$person)
(desc_wrds <- with(mraja1spl, word_stats(dialogue, person, tot = tot)))
with(mraja1spl, word_stats(desc_wrds, person, tot = tot)) #speed boost
names(desc_wrds)
htruncdf(desc_wrds$ts, 15, 5)
htruncdf(desc_wrds$gts, 15, 6)
desc_wrds$mpun
desc_wrds$word.elem
desc_wrds$sent.elem
plot(desc_wrds)
plot(desc_wrds, label=TRUE, lab.digits = 1)
with(mraja1spl, word_stats(dialogue, list(sex, died, fam.aff)))

Run the code above in your browser using DataLab