View source: R/olink_qc_plot.R
| olink_qc_plot | R Documentation |
Generates a facet plot per Panel using ggplot2::ggplot and
ggplot2::geom_point and stats::IQR plotting IQR vs. median for all samples.
Horizontal dashed lines indicate \pmIQR_outlierDef standard
deviations from the mean IQR (default 3). Vertical dashed lines indicate
\pmmedian_outlierDef standard deviations from the mean sample
median (default 3).
olink_qc_plot(
df,
check_log = NULL,
color_g = "QC_Warning",
plot_index = FALSE,
label_outliers = FALSE,
IQR_outlierDef = 3L,
median_outlierDef = 3L,
outlierLines = TRUE,
facetNrow = NULL,
facetNcol = NULL,
...
)
df |
NPX data frame in long format. Must have columns SampleID, NPX and Panel. |
check_log |
A named list returned by |
color_g |
Character value indicating which column to use as fill color (default QC_Warning). Continuous color scale for Olink(R) Sample Index (OSI) columns OSITimeToCentrifugation, OSIPreparationTemperature and OSISummary is also supported. |
plot_index |
Boolean. If FALSE (default), a point will be plotted for a sample. If TRUE, a sample's unique index number is displayed. |
label_outliers |
Boolean. If TRUE, an outlier sample will be labelled with its SampleID. (default FALSE) |
IQR_outlierDef |
The number of standard deviations from the mean IQR that defines an outlier. (default 3) |
median_outlierDef |
The number of standard deviations from the mean sample median that defines an outlier. (default 3) |
outlierLines |
Draw dashed lines at |
facetNrow |
The number of rows that the panels are arranged on. |
facetNcol |
The number of columns that the panels are arranged on. |
... |
coloroption passed to specify color order. |
An object of class "ggplot". Scatterplot shows IQR vs median for all samples per panel
if (rlang::is_installed(pkg = c("ggrepel"))) {
# standard plot
OlinkAnalyze::olink_qc_plot(
df = npx_data1,
color_g = "QC_Warning",
label_outliers = TRUE
)
# Change the outlier threshold to +/-4SD
OlinkAnalyze::olink_qc_plot(
df = npx_data1,
color_g = "QC_Warning",
IQR_outlierDef = 4L,
median_outlierDef = 4L,
label_outliers = TRUE
)
# Identify the outliers
qc <- OlinkAnalyze::olink_qc_plot(
df = npx_data1,
color_g = "QC_Warning",
IQR_outlierDef = 4L,
median_outlierDef = 4L,
label_outliers = TRUE
)
outliers <- qc$data |>
dplyr::filter(
.data[["Outlier"]] == 1L
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.