box_vis: Generate a box's visualisation

View source: R/shiny_functions.R

box_visR Documentation

Generate a box's visualisation

Description

Function for generating a visualisation for a box's selected options

Usage

box_vis(
  var,
  box_type = "primary",
  tol = NA,
  match_string = NA,
  shade_label = NA,
  shade_relative = TRUE,
  cat_vis = NA,
  df = LexOPS::lexops
)

Arguments

var

Character vector specifying which variable is selected

box_type

Which type of box is it? (one of: "primary", "warning", "Success", "danger", and "info")

tol

The area which should be highlighted. Can be a numeric vector of length two, a character vector of acceptable categories, or a list of such vectors. Each item in a tol list specifies one level.

match_string

If the variable is being matched for, which string is it relative to. Leave as NA if not a matching box.

shade_label

A character vector specifying what to label the levels. Order should match that of tol. Leave as NA if not doing a split.

shade_relative

If TRUE, the value of tol is taken to be relative to the value for match_string. If FALSE, the raw values of tol are used. If match_string is not defined, shade_relative has no effect. Default is TRUE.

cat_vis

which category should be highlighted (if a categorical variable)? Can be one of tol or match_string_val.

df

A dataframe. Default is LexOPS::lexops.

Value

A ggplot/ggwordcloud object with the required visualisation.

Examples


#box_vis("CMU.PrN", "warning", c(-1, 1), "test")

#box_vis("CMU.PrN", "warning", list(c(1, 1), c(3, 3)), shade_label = c("A1", "A2"))

#box_vis("AROU.Glasgow_Norms", "info", c(-1, 0.5), match_string = "thicket")

#box_vis("Rhyme.eSpeak.br", "danger", match_string = "thicket")

#box_vis("PoS.SUBTLEX_UK", "warning", match_string = "laura", cat_vis = "match_string_val")

#box_vis("PoS.SUBTLEX_UK", "warning", tol = "noun", match_string = "laura", cat_vis = "tol")

#box_vis("PoS.ELP", "warning")

# ignore shade_label for categorical histogram?
#box_vis("PoS.SUBTLEX_UK", "warning", list("noun", "verb"), shade_label = c("B1", "B2"))

JackEdTaylor/LexOPS documentation built on Oct. 11, 2024, 10:38 p.m.