--- title: "R exercises" output: html_document: code_folding: show editor_options: chunk_output_type: console --- ```{r setup, include = FALSE} knitr::opts_chunk$set(echo = TRUE) ``` **Exercise 1:** Define `x` and `y` vectors as below ```{r} set.seed(123523458) x <- 1:10 y <- sample(x) ``` and plot `y` as a function of `x`. **Solution to Exercise 1:** ```{r} plot(x, y) ``` **Exercise 2:** Make a linear model `y` as a function of `x`. **Solution to Exercise 2:** ```{r} model <- lm(y ~ x) ``` **Exercise 3:** Make a plot of `y` as a function of `x`, together with the linear model **Solution to Exercise 3:** ```{r} plot(x, y) abline(model) ```