visualize_logratios_facet_by2: Visualize token log ratios in pairs

Description Usage Arguments Details Value See Also

Description

Visualize token log ratios across pairs of facet values.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
visualize_logratios_facet_by2_at(data = NULL, token = NULL, facet = NULL,
  xy_nms, xy_grid, ..., filter_facet = FALSE, facet_main = NULL,
  filter_facet_base = default_filter_facet(facet_main),
  filter_facet_params = list(), color = NULL,
  lab_other = ifelse(!is.null(facet_main), paste0("Not ", facet_main),
  "Other"), num_top = 5, color_main = "grey50",
  scale_manual_base = default_scale_manual(generate_named_dual_colors(color_main,
  facet_main, lab_other)), scale_manual_params = list(),
  labs_base = default_labs(), labs_params = list(title =
  "Most Unique Words", y = "Log Odds Ratio"), theme_base = default_theme(),
  theme_params = list(legend.position = "bottom", axis.text.y =
  ggplot2::element_text(angle = 30, hjust = 1), panel.grid.major.y =
  ggplot2::element_blank()), facet_base = default_facet("name_xy"),
  facet_params = list())

visualize_logratios_facet_by2(..., token, color, facet)

Arguments

data

data.frame. Data to apply a function over.

token

bare for NSE; character for SE. Name of column in data to use for count.

facet

character. Name of column in data to use for facetting. It is set to NULL by default in the non-facet function even though it is not necessary. If specified with the non-facet version of the function, then the function acts just like the _facet version.

xy_nms

character (vector). Values to use to create a 'grid' of all combinations of values.

xy_grid

data.frame. Output from create_xy_grid().

...

dots. Additional parameters to pass to compute_logratios_facet_by2_at().

filter_facet

logical. Whether or not to filter the facet values. facet values to include and exclude. Not used if filter_facet = FALSE.

facet_main

of same type as facet values. Value of single 'main' facet.

filter_facet_base

stuff. Work similarly to other _base arguments.

filter_facet_params

list. Works similarly to other _params arguments.

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.

lab_other

character. Name to give to 'opposing' factor of facet_main.

num_top

numeric. Number of tokens to show for each facet pair.

color_main

character. Opposite color is calculated for 'opposing' color. It is advised to use this argument instead of setting values with the scale_manual_params argument.

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.

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.

Details

compute_logratios_facet_by2_at() should NOT be called beforehand.

Value

gg.

See Also

https://www.tidytextmining.com/twitter.html#comparing-token-usage. http://varianceexplained.org/r/trump-tweets/.


tonyelhabr/tetext documentation built on May 14, 2019, 8:03 a.m.