Skip to content

Instantly share code, notes, and snippets.

@cwickham
cwickham / server.r
Created November 5, 2012 05:19
anova
library(shiny)
library(ggplot2)
# Define server logic required to generate and plot a random distribution
shinyServer(function(input, output) {
generate_data <- reactive(
function(){
mu <- c(input$mu_1, input$mu_2, input$mu_3)
tmp <- data.frame(len = rnorm(length(mu) * input$n,
mean = rep(mu, each = input$n),
@cwickham
cwickham / stat_qqline.r
Created October 10, 2012 21:19
ggplot2 stat for adding lines to quantile-quantile plots
require(proto)
stat_qqline <- function (mapping = NULL, data = NULL, geom = "abline", position = "identity",
distribution = qnorm, dparams = list(), na.rm = FALSE, ...) {
StatQqline$new(mapping = mapping, data = data, geom = geom, position = position,
distribution = distribution, dparams = dparams, na.rm = na.rm, ...)
}
StatQqline <- proto(ggplot2:::Stat, {
objname <- "qqline"