Exercise 1: Define x and y vectors as below

set.seed(123523458)
x <- 1:10
y <- sample(x)

and plot y as a function of x.

Solution to Exercise 1:

plot(x, y)

Exercise 2: Make a linear model y as a function of x.

Solution to Exercise 2:

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:

plot(x, y)
abline(model)