View source: R/BlandAltmanPlot.R
BlandAltmanPlot | R Documentation |
Bland-Altman plot function
BlandAltmanPlot( var1, var2, with_gradient = FALSE, line_color = c("blue", "lightblue"), extremum_pctg = TRUE )
var1 |
a vector of numerics for the 1rst group to be compared. |
var2 |
a vector of numerics for the 2nd group to be compared. |
with_gradient |
a logical indicating if you have a lot of measures, use |
line_color |
a vector of color for the three lines : average difference and upper and lower limits of the confidence interval for the average difference. |
extremum_pctg |
a logical indicating if you want to add the percentage of points outside the confidence interval for the upper and lower limits. Default is TRUE. |
a ggplot2
object
library(ggplot2) #Small sample #Generate data x <- rnorm(30) y <- rnorm(30, mean = 5, sd = 3) #Plotting BlandAltmanPlot(var1 = x, var2 = y) #Add color by group gr <- c(rep("G1", 15), rep("G2", 15)) BlandAltmanPlot(var1 = x, var2 = y) + geom_point(aes(color = gr)) #High sample #Generate data x <- rnorm(10000) y <- rnorm(10000, mean = 5, sd = 3) #Plotting with gradient BlandAltmanPlot(var1 = x, var2 = y, with_gradient = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.