Visualize token counts.

visualize_cnts_at(data = NULL, token = NULL, color = NULL, num_top = 10,
  scale_manual_base = default_scale_manual(), scale_manual_params = list(),
  labs_base = default_labs(), labs_params = list(title = "Count of Words"),
  theme_base = default_theme(axis.text.y = ggplot2::element_text(angle = 30,
  hjust = 1), panel.grid.major.y = ggplot2::element_blank()),
  theme_params = list())

visualize_cnts(..., token, color)

visualize_cnts_facet_at(data = NULL, token = NULL, color = NULL,
  facet = NULL, num_top = 10, scale_manual_base = default_scale_manual(),
  scale_manual_params = list(), labs_base = default_labs(),
  labs_params = list(title = "Count Over Time"),
  theme_base = default_theme(axis.text.y = ggplot2::element_text(angle = 30,
  hjust = 1), panel.grid.major.y = ggplot2::element_blank()),
  theme_params = list(), facet_base = default_facet(facet),
  facet_params = list())

visualize_cnts_facet(..., token, color, facet)

Arguments

data

data.frame.

token

bare for NSE; character for SE. Name of column in data to use as unit for counting. Probably something like 'word' or 'bigram'.

color

bare for NSE; character for SE. Name of column in data to use for color basis. Even if fill is the actual ggplot2 aesthetic, the internal code will 'coerce' this column to fill. In order to simplify internal code, MUST be specified.

num_top

numeric. Number of words to show. If between 0 and 1, then assumed to be a percentage.

scale_manual_base

list. Parameters to pass to ggplot2::scale_fill_manual() or ggplot2::scale_color_manual(), depending on the aesthetic mapping. A default values argument is specified in the internal function default_scale_manual(), so if overwriting explicitly, then values should be included in the list.

scale_manual_params

list. Additional parameters to pass to ggplot2::scale_fill_manual() or ggplot2::scale_color_manual() (e.g. breaks, labels, or name). The default values specified by scale_manual_base = default_scale_manual() can be overwritten a values argument in this list (or directly with a values argument in the scale_manual_base list.

labs_base

ggplot2::labs() function. Defaults to a pre-determined set of values. It is recommended NOT to modify this argument; isntead, the _params argument should be used for customization.

labs_params

list. Additional parameters to pass to ggplot2::labs() to use in addition to and/or override the parameters set in the _base parameter.

theme_base

ggplot2::theme() function. (e.g. as ggplot2::theme_minimal().) A custom theme is supplied as a default. As with the the labs_base argument, it is NOT recommended to change this directly.

theme_params

list. Additional parameters to pass to ggplot2::labs(). Should be used in the same manner as labs_params for customization.

...

dots. Parameters to pass directly to visualize_time().

facet

bare for NSE; character for SE. Name of column to use as 'facetting' variable. Not used if not specified.

facet_base

ggplot2::facet_wrap() function. An internal function sets defaults for facets, scales, ncol, nrow, and strip.position As with the labs_base and theme_base arguments, it is NOT recommended to set this argument explicitly; instead, the accompanying _params argument should be used.

facet_params

list. Additional parameters to pass to ggplot2::facet_wrap(). Parameters passed to this argument override thos in the _base argument.

Value

gg.

gg.

Details

facet version is for facetting. 'y' value is calculated internally with dplyr::count().

Unfortunately, it seems difficult to combine this with visualize_cnts_at()

See also

https://github.com/dgrtwo/dgrtwo.github.com/blob/master/_R/2016-08-09-trump-data.Rmd.