bplot | R Documentation |
Takes vector y of binary / categorical data (eg genotype) plots a bar plot of the fraction +/- confidence intervals (from prop.test) of each unique value in y.
Optional argument by and facet provide additonal grouping / faceting variables that will result in the fractions being computed within those groups and the results plotted vertically (for by = ) and horizontally (for facet = ).
bplot(
y,
by = NULL,
facet = NULL,
col = NA,
ylim = NA,
keep.base = NULL,
xlab = "",
counts = TRUE,
wes = TRUE,
ylab = "",
title = "",
print = TRUE,
return.stats = FALSE
)
y |
categorical vector across N samples whose fraction will be plotted on the y axis |
by |
optional grouping vector, same length as y, to group on prior to plotting fractions |
facet |
optional second grouping vector, same length as y, to group on |
col |
single color or named vector to plot or NA (then brewer is used) |
keep.base |
whether to keep the base level when plotting, will be FALSE unless y is logical (ie suppress plotting FALSE value) |
xlab |
x label |
counts |
print counts alongside the by / facet labels (TRUE) |
wes |
if col = NA wes = TRUE will cause wesanderson colors to be used, otherwise standard brewer is used (TRUE) |
ylab |
y label |
title |
title |
return.stats |
return stats with confidence intervals and proportions in each tranche |
gg plot object or stats
Marcin Imielinski
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.