categorical_data_frame {metaplot} | R Documentation |
Categorical Function for Data Frame
Description
Categorical function for class 'data.frame'. Implements a simple mosaic plot.
Usage
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 |
space |
location of key (right, left, top, bottom) |
key |
list: passed to |
as.table |
passed to |
prepanel |
passed to |
scales |
passed to |
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 |
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(). |
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 |
verbose |
generate messages describing process |
... |
passed to |
See Also
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
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)