Skip to content

Instantly share code, notes, and snippets.

@Rekyt
Created March 30, 2016 13:59
Show Gist options
  • Select an option

  • Save Rekyt/8f3138f5a1492700e4034bd1e91d3dbe to your computer and use it in GitHub Desktop.

Select an option

Save Rekyt/8f3138f5a1492700e4034bd1e91d3dbe to your computer and use it in GitHub Desktop.
Use of stat qq to plot qqplots in ggplot2
# List of qqplots using 'apply()' function
#
library(ggplot2)
data(mtcars)
plot_list = apply(mtcars, 2, function(line) {
my_plot = ggplot(data.frame(x = line), aes(sample = x)) +
stat_qq() +
geom_abline(intercept = mean(line), slope = sd(line))
return(my_plot)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment