viz_dispersion.RdVizualize lexical dispersion plot
viz_dispersion(data, var, group, words = 10, symbol = NULL, alpha = 0.7)
| data | A data.frame. |
|---|---|
| var | variable that contains the words to be visualized. |
| group | If present with show a group for each line with the words color coded. |
| words | Numerical or character. If numerical it will display the n most common words. If character will show the location of said strings. |
| symbol | The word symbol. Default to is 18 (filed diamond) when number of points are less then 200 and to 108 (vertical line) when there are more then 200 points. |
| alpha | color transperency of the word symbols. |
ggplot2 object.
if (FALSE) { library(tidytext) text_data <- unnest_tokens(fairy_tales, word, text) viz_dispersion(text_data, word) viz_dispersion(text_data, word, words = c("branches", "not a word")) viz_dispersion(text_data, word, symbol = "2") viz_dispersion(text_data, word, group = book) }