Skip to contents

Draw group bar chart.

Usage

draw_barchart(
  data,
  plot_var = cr,
  cate_var = cancer,
  group_var = year,
  side_var = sex,
  side_label = NULL,
  bar_side = 1,
  topn = 10,
  grid = c(1, 1),
  ...
)

Arguments

data

A data frame or tibble.

plot_var

Var to be plotted.

cate_var

Category variable name.

group_var

Group variable name.

side_var

Panel variable name.

side_label

Labels for each side.

bar_side

Orientation of the bar chart: 1 for left and 2 for right.

topn

Top n 'plot_var' in each 'group_var' and 'side_var'.

grid

The number of rows and columns in the plot area.

...

Other options in draw_bar.

Value

Bar chart

Examples

data <- load_canreg()
rate <- create_asr(data, year, sex, cancer, event = fbs)
draw_barchart(rate)