Title: | Visualization for Norwegian Health Quality Registries |
Version: | 0.2.1 |
Description: | Assists for presentation and visualization of data from the Norwegian Health Quality Registries following the standardization based on the requirement specified by the National Service for Health Quality Registries. This requirement can be accessed from (https://www.kvalitetsregistre.no/resultater-til-publisering-pa-nett). Unfortunately the website is only available in Norwegian. |
Depends: | R (≥ 3.0) |
Imports: | ggplot2 (≥ 2.1.0), directlabels, grid, stats |
Suggests: | data.table, gridExtra, testthat |
License: | GPL-2 | file LICENSE |
Encoding: | UTF-8 |
LazyData: | true |
RoxygenNote: | 6.0.1 |
NeedsCompilation: | no |
Packaged: | 2018-03-22 13:35:51 UTC; yusman |
Author: | Yusman Kamaleri [aut, cre] |
Maintainer: | Yusman Kamaleri <ybkamaleri@gmail.com> |
Repository: | CRAN |
Date/Publication: | 2018-03-22 14:11:31 UTC |
rreg
package
Description
Data visualization for Norwegian Health Quality Registries with R. This package will assist and standardize the visualization of data from the Norwegian Health Quality Registries. The standardization is based on the requirement specified by the Nasjonalt servicemiljø for medisinske kvalitetsregistre.
Author(s)
Yusman Kamaleri <ybkamaleri@gmail.com>
hfdata as sample data for institutions
Description
hfdata is just a randomly created dataset to show how this package works. The centre names are derived from names of towns on the north-eastern part of Borneo.
Usage
hfdata
Format
hfdata
consist of several columns:
inst: The institution names and "Sabah" is the region name
id: The identification number of the centres
2003-2007: The measurement collected yearly based
case1: Cases normally distributed with mean=60 and SD=30
case2: Cases normally distributed with mean=20 and SD=2
extt: Variable with extreme values
ll: Lower limit for case2
up: Upper limit for case2
Barplot with explicit data comparison
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
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
# 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)
Barplot with point and table for comparison
Description
Create a barplot with point to visualise comparison. It is also possible to include table to show the value of the plot.
Usage
regcom(data, x, yl, yc, tab = TRUE, title, scale, ascending = TRUE, col1,
col2, lab1, lab2, num, rotate, leg1, leg2, ...)
Arguments
data |
Data set |
x |
x-axis |
yl |
Variable or column for local values |
yc |
Variable or column for national values |
tab |
Include table |
title |
Title for the plot |
scale |
Scale for x-axis ie. percentage or number |
ascending |
Sort data ascending order |
col1 |
Color for bars |
col2 |
Color for the 'diff' bar |
lab1 |
Label for table first column |
lab2 |
Label for table second column |
num |
Include denominator i.e N in the figure eg. Tawau HF (N=2088) |
rotate |
Rotate table text |
leg1 |
Text legend for bar |
leg2 |
Text legend for point |
... |
Additional arguments |
Examples
library("rreg")
regcom(data = hfdata, x = inst, yl = case2, yc = case1)
# include table
regcom(data = hfdata, x = inst, yl = case2, yc = case1, tab = FALSE)
# keep original order
regcom(data = hfdata, x = inst, yl = case2, yc = case1, scale = "Percentage", ascending = FALSE)
# text for table rotate 10%
regcom(data = hfdata, x = inst, yl = case2, yc = case1, lab1="Tawau", lab2="Negara", rotate=10)
Plot for variability
Description
Create a plot to show uncertainty either by showing the Standard Error of the Mean (SEM) or Confidence Interval (CI). Lower and upper limit should be specified. Figure should also be commented if the variability is a SEM or CI.
Usage
regerr(data, x, y, ll, ul, title, ylab, comp, col1, col2, ascending = TRUE,
flip = TRUE, ...)
Arguments
data |
Data set |
x |
x-axis |
y |
y-axis |
ll |
Lower limit |
ul |
Upper limit |
title |
Title for the plot |
ylab |
Label for y-axis |
comp |
Compare a specific bar from the rest for a vivid comparison eg. National compared to the different districts |
col1 |
Color for bars |
col2 |
Color for the 'diff' bar |
ascending |
Sort data ascending order |
flip |
Flip plot horizontally |
... |
Additional arguments |
Examples
# basic usage
regerr(hfdata, inst, case2, ll, ul)
regerr(hfdata, inst, case2, ll, ul, comp="Sabah")
Line plot to show trend
Description
Create a line plot that can be used to elucidate if trends exit over time.
Usage
regline(data, x, y, grp, title, ylab, colp, digit, ...)
Arguments
data |
Data set |
x |
x-axis |
y |
y-axis |
grp |
Group variable |
title |
Title for the plot |
ylab |
Label for y-axis |
colp |
Color palettes to use from ColorBrewer. To check other palettes run library(RColorBrewer); display.brewer.all() |
digit |
Number of digit to show |
... |
Additional arguments |
Examples
regline(data = yrdata, x=year, y=pros, grp=var)
regline(yrdata, year, pros, var, colp="Set1", digit=1)
Dartboard diagram for precision
Description
Create a dartboard style diagram to visualise precision. The middle point represent complete precision for example the objectives or plans. Imagine it's like a dartboard and the center means 100% precision or it could be completeness/achievement. The standard division of the proportion to show precision allocated in the diagram is 50%, 80% and 100%.
Usage
regrad(data, x, y, long = FALSE, title, size, pct1, pct2, col1, col2, col3,
...)
Arguments
data |
Data set |
x |
Names of variable |
y |
Value of the variable |
long |
Split whitespaces of the variable names |
title |
Title for the plot |
size |
Size of the point |
pct1 |
Percentage first pie proportion |
pct2 |
Percentage second pie proportion |
col1 |
Colour of the first pie proportion |
col2 |
Colour of the second pie proportion |
col3 |
Colour of the third pie proportion |
... |
Additional arguments |
Details
These parameters should be specified:
-
x-axis
1st column: The names of the different institutions -
y-axis
2nd column: The value to show completeness
Note
The ggplot2
package is required to run this function
Source
hfdata
is a sample data which does not derive from a real data
Examples
# basic usage
library("rreg")
regrad(data = hfdata)
regrad(data = hfdata, title = "Plot title", long = TRUE)
regrad(hfdata, y= case1, title="Plot title", size=10, col1="blue", col2="green", col3="yellow")
yrdata is sample data for trends
Description
yrdata is just a sample data to use in example for "regline" function.
Usage
yrdata
Format
yrdata
consist of these variables:
year: List of different years
var: Variable to be grouped
N: Number of n for each group
sum: Total for each year
pros: Percentage for each group