plotParkesGrid: Plot a Parkes (Consensus) Error Grid

Description Usage Arguments Value References See Also Examples

View source: R/plots.R

Description

The function uses ggplot to draw the Parkes (consensus) error grid lines according to the criteria described in the publications listed in the References section (see below). If zones have not already been assigned via the zones parameter, the function getParkesZones is called first. The values in referenceVals and testVals are then superimposed as a scatter plot. Some basic plot parameters can be specified as arguments, but the return value can also be stored and modified further before plotting (see examples and vignette).

Usage

1
2
3
4
5
plotParkesGrid(referenceVals, testVals, type = 1, title = NA,
  xlab = "Reference Glucose Concentration (mg/dL)",
  ylab = "Test Glucose Concetration (mg/dL)", linesize = 0.5,
  linetype = "solid", linecolor = "black", linealpha = 0.6,
  pointsize = 2, pointalpha = 1, zones = NA)

Arguments

referenceVals

A vector of glucose values obtained via the reference method.

testVals

A vector of glucose values obtained via a non-reference method (e.g. a new meter). The values in this vector are paired with those in referenceVals, so the length should be the same.

type

An integer (1 or 2) specifying whether to plot the grid for Type 1 or Type 2 diabetes. Defaults to 1.

title

The main plot title. Defaults to "Parkes (Consensus) Error Grid for Type [type] Diabetes".

xlab

The x-axis label. Defaults to "Reference Glucose Concentration (mg/dL)".

ylab

The y-axis label. Defaults to "Test Glucose Concentration (mg/dL)".

linesize

The size to be used when drawing the zone lines. The acceptable values are the same as for geom_segment. The default is 0.5.

linetype

The type of line to be used when drawing the zone lines. The acceptable values are the same as for geom_segment. The default is "solid".

linecolor

The color of the zone lines. The acceptable values are the same as for geom_segment. The default is "black".

linealpha

The alpha (transparency) level to be used when drawing the zone lines. The acceptable values are the same as for geom_segment. The default is 0.6.

pointsize

The size to be used when plotting the glucose data points. The acceptable values are the same as for geom_point. The default is 2.

pointalpha

The alpha (transparency) level to be used when plotting the glucose data points. The acceptable values are the same as for geom_point. The default is 1.

zones

An optional character vector specifying the Clarke zones for each paired value. If this is not supplied, getClarkeZones will be called to generate zone labels.

Value

A ggplot object is returned. If the return value is not assigned, a plot is drawn.

References

Parkes, J. L., S. L. Slatin, S. Pardo, and B.H. Ginsberg. "A New Consensus Error Grid to Evaluate the Clinical Significance of Inaccuracies in the Measurement of Blood Glucose." Diabetes Care 23, no. 8 (August 2000): 1143-48

Pfutzner, Andreas, David C. Klonoff, Scott Pardo, and Joan L. Parkes. "Technical Aspects of the Parkes Error Grid." Journal of Diabetes Science and Technology 7, no. 5 (September 2013): 1275-81

See Also

getParkesZones ggplot

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(ggplot2)

# default
plotParkesGrid(glucose_data$ref, glucose_data$test)

# with options
plotParkesGrid(glucose_data$ref, glucose_data$test,
              pointsize=2,
              pointalpha=0.5,
              linesize=2,
              linealpha=0.3,
              linetype="dotdash")

# store return value and modify
peg <- plotParkesGrid(glucose_data$ref, glucose_data$test, type=2)

peg + theme_gray() +
   theme(plot.title = element_text(size = rel(2), colour = "red"))

njfreesurfer/ega documentation built on May 23, 2019, 7:07 p.m.