Skip to content

Instantly share code, notes, and snippets.

@geoffwoollard
Last active December 22, 2015 23:09
Show Gist options
  • Save geoffwoollard/6545119 to your computer and use it in GitHub Desktop.
Save geoffwoollard/6545119 to your computer and use it in GitHub Desktop.
STAT 545A Homework 1
========================================================
My first R Markdown Document. Here's how to make one:
* open RStudio
* select File > New > R Markdown
* paste the R code in the skeleton.
* click Knit HTML to preview the page
* save the HTML locally and / or publish to RPubs
```{r}
n <- 50
a <- 2
b <- -3
sigSq <- 0.5
x <- runif(n)
y <- a + b * x + rnorm(n, sd = sqrt(sigSq))
(avgX <- mean(x))
```
kntr takes the code in the .Rmd document and makes a .md document and figures.
```{r fig.width=7, fig.height=3}
plot(x, y)
abline(a, b, col = "red")
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment