categorical_data_frame: Categorical Function for Data Frame

Description Usage Arguments See Also Examples

View source: R/categorical.R

Description

Categorical function for class 'data.frame'. Implements a simple mosaic plot.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
categorical_data_frame(x, yvar = NULL, xvar, groups = NULL, facets = NULL,
  ylab = metOption("xlab_categorical", "axislabel"),
  xlab = metOption("ylab_categorical", "axislabel"),
  na.rm = metOption("na.rm_categorical", TRUE),
  aspect = metOption("aspect_categorical", 1),
  space = metOption("space_categorical", "right"),
  key = metOption("key_categorical", "metaplot_key"),
  as.table = metOption("as.table_categorical", TRUE),
  prepanel = metOption("prepanel_categorical", function(...) list(xlim = 0:1,
  ylim = 0:1)), scales = metOption("scales_categorical", NULL),
  panel = metOption("panel_categorical", "categorical_panel"),
  colors = metOption("colors_categorical", NULL),
  fill = metOption("fill_categorical", 0.5),
  lines = metOption("lines_categorical", TRUE),
  main = metOption("main_categorical", NULL),
  sub = metOption("sub_categorical", NULL),
  tex = metOption("tex_categorical", 0.9),
  rot = metOption("rot_categorical", c(90, 0)),
  subscripts = metOption("subscripts_categorical", TRUE),
  settings = metOption("settings_categorical", NULL),
  padding = metOption("padding_categorical", 1),
  loc = metOption("loc_categorical", 5), msg = metOption("msg_categorical",
  "tilestats"), cex = metOption("cex_categorical", 1),
  gg = metOption("gg_categorical", FALSE),
  verbose = metOption("verbose_categorical", FALSE), ...)

Arguments

x

data.frame

yvar

character: y variable (optional)

xvar

character: x variable

groups

optional grouping variable (can be missing)

facets

optional conditioning variables

ylab

y axis label; can be function(x = x, var = yvar, ..)

xlab

x axis label; can be function(x = x, var = xvar, ..)

na.rm

whether to remove data points with one or more missing coordinates

aspect

passed to bwplot or ggplot; use 'fill', NA, or NULL to calculate automatically

space

location of key (right, left, top, bottom)

key

list: passed to xyplot as auto.key or to theme; can be a function groups name, groups levels, fill, lines, space, gg, type ('categorical'), and ... . See metaplot_key.

as.table

passed to xyplot

prepanel

passed to xyplot (guessed if NULL)

scales

passed to xyplot or facet_grid or facet_wrap (guessed if NULL)

panel

name or definition of panel function for lattice

colors

replacements for default colors in group order; can be length one integer to auto-select that many colors

fill

whether to fill rectangles for each group: logical, or alpha values between 0 and 1

lines

whether to plot borders for each group: logical, or alpha values between 0 and 1

main

character, or a function of x, yvar, xvar, groups, facets

sub

character, or a function of x, yvar, xvar, groups, facets

tex

tile expansion: scale factor for reducing each tile size relative to full size (<= 1)

rot

rotation for axis labels; can be length 2 for y and x axes, respectively

subscripts

passed to xyplot

settings

default parameter settings: a list from which matching elements are passed to lattice (as par.settings) or to ggplot theme() and facet_wrap() or facet_grid(). ncol and nrow are used as layout indices for lattice (for homology with facet_wrap).

padding

numeric (will be recycled to length 4) giving plot margins in default units: top, right, bottom, left (in multiples of 5.5 points for ggplot)

loc

where to print statistics in a tile

msg

a function of x and y to print text in a tile

cex

expansion for msg text

gg

logical: whether to generate ggplot instead of trellis

verbose

generate messages describing process

...

passed to region

See Also

categorical_panel

Other categorical: categorical.data.frame, categorical_panel, categorical, panel_tile

Other metaplot: boxplot_data_frame, corsplom_data_frame, densplot_data_frame, metaplot_key, metaplot, scatter_data_frame, test_metaplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
library(magrittr)
library(dplyr)
library(csv)
x <- as.csv(system.file(package = 'metaplot', 'extdata/theoph.csv'))
x %<>% pack
x %>% metaplot(site)
x %>% metaplot(site, gg = T)
x %>% metaplot(arm, site)
x %>% metaplot(arm, site, gg = T)
x %>% metaplot(arm, site, cohort)
x %>% metaplot(arm, site, cohort, gg = T)
x %>% metaplot(arm, site, cohort, space = 'top')
x %>% metaplot(arm, site, , cohort)
x %>% metaplot(arm, site, , cohort, gg = T)

x %>% metaplot(arm, site, , cohort, rot = c(0,90))
x %>% metaplot(arm, site, , cohort, rot = c(0,90), gg = T)
x %>% metaplot(arm, site, , cohort, rot = c(45, 45))
x %>% metaplot(subject,cohort,arm, site, lines = F, rot = c(45,45))
x %>% metaplot(subject,cohort,arm, site, lines = F, rot = c(45,45), gg=T)
# panel-specific axis not well-supported for gg version
x %>% metaplot(subject,cohort,,arm, site)
x %>% metaplot(subject,cohort,,arm, site, gg=T)

metaplot documentation built on May 1, 2019, 10:17 p.m.