Created
January 8, 2013 15:52
-
-
Save jknowles/4484868 to your computer and use it in GitHub Desktop.
Draw a normal distribution with a given number of observations. Demonstrate what sample sizes and approximations can mean.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
shinyServer(function(input,output){ | |
output$distPlot<-reactivePlot(function(){ | |
dist<-rnorm(input$obs) | |
p<-qplot(dist,binwidth=0.1)+geom_vline(xintercept=mean(dist))+theme_dpi() | |
p<-p+coord_cartesian(xlim=c(-4,4))+geom_vline(xintercept=median(dist),color=I("red")) | |
print(p) | |
}) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(shiny) | |
library(ggplot2) | |
library(eeptools) | |
shinyUI(pageWithSidebar( | |
# Title | |
headerPanel("Normality"), | |
sidebarPanel( | |
sliderInput("obs","Number of observations:", | |
min=0,max=1000,value=100) | |
), | |
# GGPLOT | |
mainPanel( | |
plotOutput("distPlot") | |
) | |
)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment