plot_BA: Bland-Altman plot

View source: R/core_functions.R

plot_BAR Documentation

Bland-Altman plot

Description

Draws the Bland-Altman plot. The differences among pair of data from the same subject is represented on y-axis. The mean of data from the same subject is represented on x-axis. Additionally, a bar plot with the proportions of differences can be drawn.

Usage

plot_BA(data, y, id, rm = NULL, type = c("BA", "bars"))

Arguments

data

A data frame containing at least two columns: outcome and subject identifier.

y

Character string indicating the name of the outcome column in the data set.

id

Character string indicating the name of the subjects column in the data set.

rm

Optional. Character string indicating the name of column that stands for the repeated measurements from the same subjects in the dataset. Only needed to identify the differences in the Bland-Altman plot.

type

Character. Which plot has to be drawn? Default option is Bland-Altman plot ("BA" option). Alternatively, the bar plot of the proportion of the differences can be created ("bars" option).

Value

A list with the following components:

  • plot. An object of class ggplot. The plot generated.

  • data. An object of class dataframe that contains the data used to generated the plot.

Examples

plot_BA(EPP,y="Social",id="id")
plot_BA(EPP,y="Social",id="id",rm="Year")
plot_BA(EPP,y="Social",id="id",type="bars")


iccCounts documentation built on June 9, 2022, 5:06 p.m.