Skip to content

Instantly share code, notes, and snippets.

@daattali
Created September 12, 2013 18:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save daattali/6541810 to your computer and use it in GitHub Desktop.
Save daattali/6541810 to your computer and use it in GitHub Desktop.
n <- 50
a <- 2
b <- -3
sigSq <- 0.5
x <- runif(n)
norm <- rnorm(n, sd = sqrt(sigSq))
y <- a + b * x + norm
plot(x,y)
abline(a, b, col = "blue")
@songcai
Copy link

songcai commented Sep 18, 2013

This is a clear R script. It will be better if you separate code chunks of different meanings with blank lines and comments. For example, add a blank line before x <- runif(n) and a blank line before plot(x,y).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment