{r setup, include=FALSE} knitr::opts_chunk$set(echo = TRUE)
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r cars} set.seed(1) x1 <- runif(100) x2 <- 0.5 * x1 + rnorm(100) / 10 y <- 2 + 2 * x1 + 0.3 * x2 + rnorm(100) correlation <- cor(x1, x2) print(correlation) plot(x1, x2, main = “Scatterplot of x1 vs x2”, xlab = “x1”, ylab = “x2”) model <- lm(y ~ x1 + x2) summary(model) model_x1 <- lm(y ~ x1) summary(model_x1) x1 <- c(x1, 0.1) x2 <- c(x2, 0.8) y <- c(y, 6)
model_new <- lm(y ~ x1 + x2) model_x1_new <- lm(y ~ x1) model_x2_new <- lm(y ~ x2)
## Including Plots
You can also embed plots, for example:
```{r pressure, echo=FALSE}
plot(pressure)
Note that the echo = FALSE
parameter was added to the
code chunk to prevent printing of the R code that generated the
plot.