Exercise

# Matrices

In R, a matrix is a collection of elements of the same data type (numeric, character, or logical) arranged into a fixed number of rows and columns. Since you are only working with rows and columns, a matrix is called two-dimensional.

You can construct a matrix with the `matrix()`

function. For example:

```
mymatrix <- matrix(
c(36, 34, 37, 35, 33, 32, 35, 31,
37, 35, 38, 36, 35, 33, 35, 33,
39, 37, 40, NA, 36, 35, 37, 35,
36, 34, 37, 35, 34, 32, 36, 32),
nrow=8, ncol=4)
```

`mymatrix`

is preloaded in the workspace. Notice that the columns of this matrix are equal to `QR1`

, `QR2`

, `QR3`

and `QR4`

. These vectors are preloaded in the workspace as well.

An alternative function to construct a **matrix** is `cbind()`

. Take a look at its documentation and use it in the exercise.

Once you have created your matrix, functions can be called on it. One example is the `cor()`

function to calculate correlation. Take a look at its documentation.

Instructions

**100 XP**