qc_plot | R Documentation |
Create Shewhary Chart like QC plots for our metabolomics workflow.
qc_plot(data, x, y, color_by, avg, stdev, rsd, xlabel = "", ylabel = "")
data |
Dataframe containing all information. See details for more information on the structure. |
x |
what to plot on the x-axis, in general something with a time component in it. |
y |
what to plot on the y-axis, in general something like peak area or signal height. |
color_by |
color the lines and facet according to this column. |
avg |
the column with the average per compound. |
stdev |
the column with the standard deviation per compound. |
rsd |
the column with the RSD / CV per compound, this will be used in the title of the facets. |
xlabel |
set the label of the x-axis. |
ylabel |
set the label of the y-axis. |
data
should be data frame which contains at least all the parameters as columns.
A ggplot2 plot is returned.
Rico Derks
require(dplyr) set.seed(11) # create a dummy frame my_data <- data.frame(x = rep(1:8, 5), y = rnorm(40, mean = 10), group = as.factor(rep(1:5, 8))) # calculate average / sd / rsd my_data <- my_data %>% group_by(group) %>% mutate(avg = mean(y), stdev = sd(y), rsd = stdev / avg * 100) # make the QC plot p <- qc_plot(data = my_data, x = x, y = y, color_by = group, avg = avg, stdev = stdev, rsd = rsd, xlabel = "Measurement index", ylabel = "peak area")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.