regbar: Barplot with explicit data comparison

Description Usage Arguments Examples

View source: R/regbar.R

Description

Create a barplot with the posibility to differentiate a specific item compared to the rest. This is useful in a situation when there is a need to show the total value as compared to each items in the x-axis. A specific example related to the Norwegian Health Registries is when the aggregated value from each health institutions or health regions is compared to the national data.

Usage

1
2
regbar(data, x, y, comp, num, aim = NULL, split = NULL, ascending = TRUE,
  title, ylab, col1, col2, col3, flip = TRUE, ...)

Arguments

data

Data set

x

x-axis

y

y-axis

comp

Compare a specific bar from the rest for a vivid comparison eg. National compared to the different districts

num

Include denominator i.e N in the figure eg. Tawau HF (N=2088)

aim

A line on y-axis indicating aim

split

Where to split inside and outside text eg. 10% of max as split=0.1

ascending

Sort data ascending order

title

Title for the plot

ylab

Label for y-axis

col1

Color for bars

col2

Color for the 'diff' bar

col3

Color for aim line

flip

Flip plot horizontally

...

Additional arguments

Examples

1
2
3
4
5
6
7
8
# basic usage
library("rreg")
regbar(data = hfdata, x = inst, y = case2)
regbar(hfdata, inst, case2, comp = "Tawau HF")
regbar(hfdata, inst, 2007, comp = "Taw", num = extt)

# split text visualisatio at 5% of max value
regbar(hfdata, inst, 2007, comp = "Taw", split = 0.05)

ybkamaleri/rreg documentation built on March 26, 2018, 11:02 a.m.