Description Usage Arguments Value References See Also Examples
The function uses ggplot
to draw the
Clarke error grid lines according to the criteria described in the
original publication by Clarke et. al. (see reference below). If zones
have not already been assigned via the zones
parameter, the
function getClarkeZones
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).
1 2 3 4 | plotClarkeGrid(referenceVals, testVals, title = "Clarke Error Grid",
xlab = "", ylab = "", linesize = 0.5, linetype = "solid",
linecolor = "black", linealpha = 0.6, pointsize = 2, pointalpha = 1,
zones = NA, unit = "gram")
|
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 |
title |
The main plot title. Defaults to "Clarke Error Grid". |
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 |
linetype |
The type of line to be used when drawing the zone lines. The
acceptable values are the same as for |
linecolor |
The color of the zone lines. The acceptable values are the
same as for |
linealpha |
The alpha (transparency) level to be used when drawing
the zone lines. The acceptable values are the same as for
|
pointsize |
The size to be used when plotting the glucose data points.
The acceptable values are the same as for |
pointalpha |
The alpha (transparency) level to be used when plotting
the glucose data points. The acceptable values are the same as for
|
zones |
An optional character vector specifying the Clarke zones
for each paired value. If this is not supplied, |
unit |
A string specifying the units of measurement. This should be either
|
A ggplot
object is returned. If the return
value is not assigned, a plot is drawn.
Clarke, W. L., D. Cox, L. A. Gonder-Frederick, W. Carter, and S. L. Pohl. "Evaluating Clinical Accuracy of Systems for Self-Monitoring of Blood Glucose." Diabetes Care 10, no. 5 (September 1, 1987): 622-28.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | library(ggplot2)
# default
plotClarkeGrid(glucose_data$ref, glucose_data$test)
# with options
plotClarkeGrid(glucose_data$ref, glucose_data$test,
pointsize=1.5,
pointalpha=0.6,
linetype="dashed")
# store return value and modify
ceg <- plotClarkeGrid(glucose_data$ref, glucose_data$test)
ceg + theme_gray() +
theme(plot.title = element_text(size = rel(2), colour = "blue"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.