bplot | R Documentation |
Wrapper function to create table of binomial confidence intervals and draw as a forest plot.
bplot(
data,
varname,
byvar,
varname_label = names(varname),
byvar_label = names(byvar),
main = byvar_label,
xlab = byvar_label,
names = NULL,
col = c("dodgerblue4", "dodgerblue2"),
percent = FALSE,
conf = 0.95,
digits = ifelse(percent, 0L, 2L),
show_overall = TRUE,
show_missing = TRUE,
alpha_missing = 1,
widths = c(1, 2, 1),
col.bar = c(grey(0.95), NA),
group.bar = FALSE,
...
)
tabler_bincon(
data,
varname,
byvar,
varname_label = names(varname),
byvar_label = names(byvar),
main = byvar_label,
xlab = byvar_label,
names = NULL,
col = c("dodgerblue4", "dodgerblue2"),
percent = FALSE,
conf = 0.95,
digits = ifelse(percent, 0L, 2L),
show_overall = TRUE,
show_missing = TRUE,
alpha_missing = 1,
widths = c(1, 2, 1),
col.bar = c(grey(0.95), NA),
group.bar = FALSE,
...
)
data |
a matrix or data frame with variables |
varname , byvar |
one or more variables in note that |
varname_label , byvar_label |
optional labels for each |
main , xlab |
the x-axis and title labels |
names |
optional vector of names for each panel to override defaults |
col |
a vector of colors for each |
percent |
logical; if |
conf |
confidence level; passed to |
digits |
the number of places past the decimal to keep |
show_overall , show_missing |
logical; if |
alpha_missing |
if |
widths |
a vector of widths for each panel, recycled as needed |
col.bar |
a vector of colors for background bars, recycled as needed |
group.bar |
logical; if |
... |
additional graphical parameters passed to |
set.seed(1)
dat <- mtcars[sample(nrow(mtcars), 100L, TRUE), ]
dat[1, 2] <- NA
vv <- c('cyl', 'vs', 'gear', 'carb')
dat$gear <- factor(dat$gear, 3:6)
bplot(dat, vv, 'am')
bplot(
dat, vv, 'am', percent = TRUE,
col = c(0, seq_along(vv)) + 1L,
main = 'Manual rate', xlab = 'Proportion of manual'
)
bplot(
dat, setNames(vv, case(vv)), 'am',
col = c('red', 'grey50', 'blue', 'grey50', 'blue'),
conf = 0.9, alpha_missing = 0.4
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.